From 075354c842a4c95bb022d726ee3118ed866f941c Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Fri, 16 May 2008 22:34:20 +0000 Subject: [PATCH] Activity Service -fix schema bootstrap git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9146 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../create-activities-tables.sql | 2 +- .../create-activities-tables.sql | 2 +- .../create-activities-tables.sql | 2 +- .../repo/domain/schema/SchemaBootstrap.java | 17 +++++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.HSQLDialect/create-activities-tables.sql b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.HSQLDialect/create-activities-tables.sql index 692324c7dc..f2994dafe6 100644 --- a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.HSQLDialect/create-activities-tables.sql +++ b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.HSQLDialect/create-activities-tables.sql @@ -67,5 +67,5 @@ INSERT INTO alf_applied_patch VALUES ( 'patch.db-V3.0-0-CreateActivitiesTables', 'Executed script create V3.0: Created activities tables', - 0, 125, -1, 126, null, 'UNKNOWN', 1, 1, 'Script completed' + 0, 125, -1, 126, NOW, 'UNKNOWN', 1, 1, 'Script completed' ); diff --git a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.MySQLInnoDBDialect/create-activities-tables.sql b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.MySQLInnoDBDialect/create-activities-tables.sql index 60bc073a2f..45aae16d27 100644 --- a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.MySQLInnoDBDialect/create-activities-tables.sql +++ b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.MySQLInnoDBDialect/create-activities-tables.sql @@ -64,5 +64,5 @@ INSERT INTO alf_applied_patch VALUES ( 'patch.db-V3.0-0-CreateActivitiesTables', 'Executed script create V3.0: Created activities tables', - 0, 125, -1, 126, null, 'UNKNOWN', 1, 1, 'Script completed' + 0, 125, -1, 126, now(), 'UNKNOWN', 1, 1, 'Script completed' ); \ No newline at end of file diff --git a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.Oracle9Dialect/create-activities-tables.sql b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.Oracle9Dialect/create-activities-tables.sql index c604aa8307..7406a26893 100644 --- a/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.Oracle9Dialect/create-activities-tables.sql +++ b/config/alfresco/dbscripts/create/3.0/org.hibernate.dialect.Oracle9Dialect/create-activities-tables.sql @@ -73,5 +73,5 @@ INSERT INTO alf_applied_patch VALUES ( 'patch.db-V3.0-0-CreateActivitiesTables', 'Executed script create V3.0: Created activities tables', - 0, 125, -1, 126, null, 'UNKNOWN', 1, 1, 'Script completed' + 0, 125, -1, 126, SYSDATE, 'UNKNOWN', 1, 1, 'Script completed' ); diff --git a/source/java/org/alfresco/repo/domain/schema/SchemaBootstrap.java b/source/java/org/alfresco/repo/domain/schema/SchemaBootstrap.java index 77b1428d48..e1c9a0b3a9 100644 --- a/source/java/org/alfresco/repo/domain/schema/SchemaBootstrap.java +++ b/source/java/org/alfresco/repo/domain/schema/SchemaBootstrap.java @@ -535,7 +535,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean /** * Builds the schema from scratch or applies the necessary patches to the schema. */ - private void updateSchema(Configuration cfg, Session session, Connection connection) throws Exception + private boolean updateSchema(Configuration cfg, Session session, Connection connection) throws Exception { boolean create = false; try @@ -604,6 +604,8 @@ public class SchemaBootstrap extends AbstractLifecycleBean // Execute any post-auto-update scripts checkSchemaPatchScripts(cfg, session, connection, postUpdateScriptPatches, true); } + + return create; } /** @@ -956,7 +958,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean // Allocate buffer for executed statements executedStatementsThreadLocal.set(new StringBuilder(1024)); - updateSchema(cfg, session, connection); + boolean create = updateSchema(cfg, session, connection); // Copy the executed statements to the output file File schemaOutputFile = null; @@ -981,10 +983,13 @@ public class SchemaBootstrap extends AbstractLifecycleBean LogUtil.info(logger, MSG_ALL_STATEMENTS, schemaOutputFile.getPath()); } - // verify that all patches have been applied correctly - checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false); // check scripts - checkSchemaPatchScripts(cfg, session, connection, preUpdateScriptPatches, false); // check scripts - checkSchemaPatchScripts(cfg, session, connection, postUpdateScriptPatches, false); // check scripts + if (! create) + { + // verify that all patches have been applied correctly + checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false); // check scripts + checkSchemaPatchScripts(cfg, session, connection, preUpdateScriptPatches, false); // check scripts + checkSchemaPatchScripts(cfg, session, connection, postUpdateScriptPatches, false); // check scripts + } // Remove the flag indicating a running bootstrap setBootstrapCompleted(connection);