// we will run are based on this path under /src/main/resources)
String packagePath = V5_0_2014_11_04__Enable_XMLWorkflow_Migration.class.getPackage().getName().replace(".", "/");
// Get the contents of our DB Schema migration script, based on path & DB type
// (e.g. /src/main/resources/[path-to-this-class]/postgres/xml_workflow_migration.sql)
String dbMigrateSQL = new ClassPathResource(packagePath + "/" +
DatabaseManager.getDbKeyword() +
"/xml_workflow_migration.sql", getClass().getClassLoader()).loadAsString(Constants.DEFAULT_ENCODING);
// Actually execute the Database schema migration SQL
// This will create the necessary tables for the XMLWorkflow feature
DatabaseUtils.executeSql(connection, dbMigrateSQL);
// Get the contents of our data migration script, based on path & DB type
// (e.g. /src/main/resources/[path-to-this-class]/postgres/data_workflow_migration.sql)
String dataMigrateSQL = new ClassPathResource(packagePath + "/" +
DatabaseManager.getDbKeyword() +
"/data_workflow_migration.sql", getClass().getClassLoader()).loadAsString(Constants.DEFAULT_ENCODING);
// Actually execute the Data migration SQL
// This will migrate all existing traditional workflows to the new XMLWorkflow system & tables