diff --git a/docs/release-notes.md b/docs/release-notes.md
index b7dd50df97..1d186e41a7 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,3 +1,17 @@
+## 3.6.3
+
+
Bugfixes
+* [1207575](https://bugzilla.redhat.com/show_bug.cgi?id=1207575) - Zanata still creates MyISAM (not InnoDB) tables in some cases
+
+-----------------------
+
+## 3.6.2
+
+Bugfixes
+* [1206018](https://bugzilla.redhat.com/show_bug.cgi?id=1206018) - RichFaces: Remote Command Execution via insufficient EL parameter sanitization
+
+-----------------------
+
## 3.6.1
Bugfixes
diff --git a/pom.xml b/pom.xml
index 7192420829..94e902014c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -368,6 +368,12 @@
${project.version}
+
+ org.zanata
+ zanata-liquibase
+ ${project.version}
+
+
com.google.gwt
gwt-dev
@@ -1398,6 +1404,7 @@
+ zanata-liquibase
zanata-model
zanata-war
zanata-test-war
diff --git a/zanata-liquibase/pom.xml b/zanata-liquibase/pom.xml
new file mode 100644
index 0000000000..0e2dcab0b3
--- /dev/null
+++ b/zanata-liquibase/pom.xml
@@ -0,0 +1,32 @@
+
+
+
+ server
+ org.zanata
+ 3.6.3-SNAPSHOT
+
+ 4.0.0
+
+ zanata-liquibase
+
+
+
+
+ maven-surefire-plugin
+
+ false
+
+
+
+
+
+
+
+ org.liquibase
+ liquibase-core
+
+
+
+
diff --git a/zanata-liquibase/src/main/java/liquibase/ext/CreateTableGeneratorInnoDB.java b/zanata-liquibase/src/main/java/liquibase/ext/CreateTableGeneratorInnoDB.java
new file mode 100644
index 0000000000..1db47f6a97
--- /dev/null
+++ b/zanata-liquibase/src/main/java/liquibase/ext/CreateTableGeneratorInnoDB.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2015, Red Hat, Inc. and individual contributors as indicated by the
+ * @author tags. See the copyright.txt file in the distribution for a full
+ * listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package liquibase.ext;
+
+import liquibase.database.Database;
+import liquibase.database.core.MySQLDatabase;
+import liquibase.exception.UnexpectedLiquibaseException;
+import liquibase.exception.ValidationErrors;
+import liquibase.logging.LogFactory;
+import liquibase.logging.Logger;
+import liquibase.sql.Sql;
+import liquibase.sql.UnparsedSql;
+import liquibase.sqlgenerator.SqlGeneratorChain;
+import liquibase.sqlgenerator.core.CreateTableGenerator;
+import liquibase.statement.core.CreateTableStatement;
+import liquibase.structure.DatabaseObject;
+
+import java.util.Collection;
+
+/**
+ * A create table statement generator to force the use of the InnoDB engine
+ * on MySQL/MariaDB, unless the engine has already been specified by other
+ * means (eg modifySql).
+ *
+ * Note: SqlGenerator implementations must live in package
+ * "liquibase.ext" (or similar) to be automatically registered.
+ *
+ *
+ * @author Sean Flanigan sflaniga@redhat.com
+ */
+@SuppressWarnings("unused")
+public class CreateTableGeneratorInnoDB extends CreateTableGenerator {
+
+ @Override
+ public boolean supports(CreateTableStatement statement, Database database) {
+ // NB this will include MariaDB (with Liquibase 3.4+)
+ return database instanceof MySQLDatabase;
+ }
+
+ @Override
+ public int getPriority() {
+ // Higher priority than the built-ins
+ return PRIORITY_DATABASE + 1;
+ }
+
+ @Override
+ public ValidationErrors validate(CreateTableStatement createTableStatement,
+ Database database, SqlGeneratorChain sqlGeneratorChain) {
+ return sqlGeneratorChain.validate(createTableStatement, database);
+ }
+
+ @Override
+ public Sql[] generateSql(CreateTableStatement statement, Database database,
+ SqlGeneratorChain sqlGeneratorChain) {
+ Logger log = LogFactory.getLogger();
+
+ boolean foundCreateTable = false;
+ Sql[] sqls = sqlGeneratorChain.generateSql(statement, database).clone();
+
+ // Append " ENGINE=INNODB" to CREATE TABLE unless ENGINE already
+ // specified. This is clumsy, but Liquibase doesn't have seem
+ // to have any better hooks for this.
+ for (int i = 0; i < sqls.length; i++) {
+ Sql sql = sqls[i];
+ String sqlText = sql.toSql();
+ String sqlUpper = sqlText.trim().toUpperCase();
+ if (sqlUpper.startsWith("CREATE TABLE ")) {
+ foundCreateTable = true;
+
+ if (!(sqlUpper.contains(" ENGINE ") || sqlUpper
+ .contains(" ENGINE="))) {
+ log.info("Adding ENGINE=INNODB to generated SQL for table "
+ + statement.getTableName());
+ sqlText += " ENGINE=INNODB ";
+ DatabaseObject[] objects = toArray(
+ sql.getAffectedDatabaseObjects());
+ sqls[i] =
+ new UnparsedSql(sqlText, sql.getEndDelimiter(),
+ objects);
+ } else {
+ log.info("SQL for CREATE TABLE already contains ENGINE for table "
+ + statement.getTableName());
+ }
+ }
+ }
+ if (!foundCreateTable) {
+ throw new UnexpectedLiquibaseException(
+ "CREATE TABLE not found; unable to ensure ENGINE=INNODB for table "
+ + statement.getTableName());
+ }
+ return sqls;
+ }
+
+ private DatabaseObject[] toArray(
+ Collection extends DatabaseObject> objects) {
+ return objects.toArray(
+ new DatabaseObject[objects.size()]);
+ }
+
+}
diff --git a/zanata-liquibase/src/main/java/liquibase/ext/MySQLDatabaseWithLog.java b/zanata-liquibase/src/main/java/liquibase/ext/MySQLDatabaseWithLog.java
new file mode 100644
index 0000000000..fdf270934f
--- /dev/null
+++ b/zanata-liquibase/src/main/java/liquibase/ext/MySQLDatabaseWithLog.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015, Red Hat, Inc. and individual contributors as indicated by the
+ * @author tags. See the copyright.txt file in the distribution for a full
+ * listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package liquibase.ext;
+
+
+import liquibase.change.Change;
+import liquibase.changelog.ChangeSet;
+import liquibase.changelog.DatabaseChangeLog;
+import liquibase.database.Database;
+import liquibase.database.core.MySQLDatabase;
+import liquibase.exception.LiquibaseException;
+import liquibase.exception.RollbackImpossibleException;
+import liquibase.exception.ValidationErrors;
+import liquibase.logging.LogFactory;
+import liquibase.logging.Logger;
+import liquibase.sql.Sql;
+import liquibase.sql.visitor.SqlVisitor;
+import liquibase.sqlgenerator.SqlGeneratorChain;
+import liquibase.sqlgenerator.core.AbstractSqlGenerator;
+import liquibase.statement.SqlStatement;
+import liquibase.util.StreamUtil;
+
+import java.io.StringWriter;
+import java.util.List;
+
+
+/**
+ * A slightly modified MySQLDatabase which simply logs each change before
+ * executing.
+ *
+ * Note: SqlGenerator implementations must live in package
+ * "liquibase.ext" (or similar) to be automatically registered.
+ *
+ *
+ * @author Sean Flanigan sflaniga@redhat.com
+ */
+@SuppressWarnings("unused")
+public class MySQLDatabaseWithLog extends MySQLDatabase {
+
+ @Override
+ public int getPriority() {
+ // Higher priority than the built-ins
+ return PRIORITY_DATABASE;
+ }
+
+ @Override
+ public void executeStatements(Change change, DatabaseChangeLog changeLog,
+ List sqlVisitors) throws LiquibaseException {
+ if (getConnection() != null) {
+ // don't log if running offline
+ Logger log = LogFactory.getLogger();
+ log.info("Executing " + change.getClass().getSimpleName());
+ }
+ super.executeStatements(change, changeLog, sqlVisitors);
+ }
+}
diff --git a/zanata-war/pom.xml b/zanata-war/pom.xml
index 048dc7a8d3..d2a93838b2 100644
--- a/zanata-war/pom.xml
+++ b/zanata-war/pom.xml
@@ -1270,6 +1270,11 @@
+
+ org.zanata
+ zanata-liquibase
+
+
org.zanata
zanata-common-util
diff --git a/zanata-war/src/main/resources/db/changelogs/db.changelog-1.0.xml b/zanata-war/src/main/resources/db/changelogs/db.changelog-1.0.xml
index db6c1518f0..747f34eb83 100644
--- a/zanata-war/src/main/resources/db/changelogs/db.changelog-1.0.xml
+++ b/zanata-war/src/main/resources/db/changelogs/db.changelog-1.0.xml
@@ -18,13 +18,4 @@
h2 baseline schema
-
-
- Set session's default storage engine to INNODB (mysql ver > 5.5)
- SET storage_engine=InnoDB
-
-
- Set session's default storage engine to INNODB (mysql ver < 5.5)
- SET default_storage_engine=InnoDB
-
diff --git a/zanata-war/src/main/resources/db/changelogs/db.changelog-3.6.xml b/zanata-war/src/main/resources/db/changelogs/db.changelog-3.6.xml
index 336aae6ad0..bc527cfebb 100644
--- a/zanata-war/src/main/resources/db/changelogs/db.changelog-3.6.xml
+++ b/zanata-war/src/main/resources/db/changelogs/db.changelog-3.6.xml
@@ -30,4 +30,116 @@
referencedTableName = "HProject" referencedColumnNames = "id"/>
+
+
+ Ensure InnoDB for HIterationGroup
+ ALTER TABLE HIterationGroup ENGINE = INNODB
+
+
+ Ensure InnoDB for HIterationGroup_Maintainer
+ ALTER TABLE HIterationGroup_Maintainer ENGINE = INNODB
+
+
+ Ensure InnoDB for HIterationGroup_ProjectIteration
+ ALTER TABLE HIterationGroup_ProjectIteration ENGINE = INNODB
+
+
+ Ensure InnoDB for HCredentials
+ ALTER TABLE HCredentials ENGINE = INNODB
+
+
+ Ensure InnoDB for HProject_AllowedRole
+ ALTER TABLE HProject_AllowedRole ENGINE = INNODB
+
+
+ Ensure InnoDB for HRoleAssignmentRule
+ ALTER TABLE HRoleAssignmentRule ENGINE = INNODB
+
+
+ Ensure InnoDB for HCopyTransOptions
+ ALTER TABLE HCopyTransOptions ENGINE = INNODB
+
+
+ Ensure InnoDB for HRawDocument
+ ALTER TABLE HRawDocument ENGINE = INNODB
+
+
+ Ensure InnoDB for HDocument_RawDocument
+ ALTER TABLE HDocument_RawDocument ENGINE = INNODB
+
+
+ Ensure InnoDB for HDocumentUpload
+ ALTER TABLE HDocumentUpload ENGINE = INNODB
+
+
+ Ensure InnoDB for HDocumentUploadPart
+ ALTER TABLE HDocumentUploadPart ENGINE = INNODB
+
+
+ Ensure InnoDB for HAccountOption
+ ALTER TABLE HAccountOption ENGINE = INNODB
+
+
+ Ensure InnoDB for HPersonEmailValidationKey
+ ALTER TABLE HPersonEmailValidationKey ENGINE = INNODB
+
+
+ Ensure InnoDB for HProject_Validation
+ ALTER TABLE HProject_Validation ENGINE = INNODB
+
+
+ Ensure InnoDB for HProjectIteration_Validation
+ ALTER TABLE HProjectIteration_Validation ENGINE = INNODB
+
+
+ Ensure InnoDB for TransMemory
+ ALTER TABLE TransMemory ENGINE = INNODB
+
+
+ Ensure InnoDB for TransMemory_Metadata
+ ALTER TABLE TransMemory_Metadata ENGINE = INNODB
+
+
+ Ensure InnoDB for TransMemoryUnit
+ ALTER TABLE TransMemoryUnit ENGINE = INNODB
+
+
+ Ensure InnoDB for TransMemoryUnitVariant
+ ALTER TABLE TransMemoryUnitVariant ENGINE = INNODB
+
+
+ Ensure InnoDB for HTextFlowTargetReviewComment
+ ALTER TABLE HTextFlowTargetReviewComment ENGINE = INNODB
+
+
+
+
+
+
+ SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_SCHEMA = SCHEMA()
+ AND ENGINE = 'InnoDB'
+ AND TABLE_NAME='Activity';
+
+
+ Ensure InnoDB for Activity
+ ALTER TABLE Activity ENGINE = INNODB
+
+
+ Ensure InnoDB for IterationGroup_Locale
+ ALTER TABLE IterationGroup_Locale ENGINE = INNODB
+
+
+ Ensure InnoDB for WebHook
+ ALTER TABLE WebHook ENGINE = INNODB
+
+
+ Ensure InnoDB for DATABASECHANGELOG
+ ALTER TABLE DATABASECHANGELOG ENGINE = INNODB
+
+
+ Ensure InnoDB for DATABASECHANGELOGLOCK
+ ALTER TABLE DATABASECHANGELOGLOCK ENGINE = INNODB
+
+
diff --git a/zanata-war/src/main/resources/db/changelogs/db.changelog-3.7.xml b/zanata-war/src/main/resources/db/changelogs/db.changelog-3.7.xml
index 5f7b437f58..4e8b728784 100644
--- a/zanata-war/src/main/resources/db/changelogs/db.changelog-3.7.xml
+++ b/zanata-war/src/main/resources/db/changelogs/db.changelog-3.7.xml
@@ -10,4 +10,7 @@
+
+
diff --git a/zanata-war/src/main/resources/db/changelogs/db.changelog-validations.xml b/zanata-war/src/main/resources/db/changelogs/db.changelog-validations.xml
new file mode 100644
index 0000000000..118ad9f40b
--- /dev/null
+++ b/zanata-war/src/main/resources/db/changelogs/db.changelog-validations.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ SELECT count(*) FROM information_schema.tables
+ WHERE TABLE_SCHEMA = SCHEMA() AND engine != 'InnoDB'
+
+
+ Check that all tables are InnoDB
+
+
+
diff --git a/zanata-war/src/main/resources/db/db.changelog.xml b/zanata-war/src/main/resources/db/db.changelog.xml
index cf5824a14c..1d49801c8e 100644
--- a/zanata-war/src/main/resources/db/db.changelog.xml
+++ b/zanata-war/src/main/resources/db/db.changelog.xml
@@ -40,10 +40,12 @@
-
+
+