diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml
index 75f88ee3cf..9b94e9dfda 100644
--- a/config/alfresco/bootstrap-context.xml
+++ b/config/alfresco/bootstrap-context.xml
@@ -139,6 +139,7 @@
+
diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index ff489c1561..f3015416de 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -1186,6 +1186,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/dao/dao-context.xml b/config/alfresco/dao/dao-context.xml
index 493eaf5df7..2410c8a763 100644
--- a/config/alfresco/dao/dao-context.xml
+++ b/config/alfresco/dao/dao-context.xml
@@ -275,11 +275,7 @@
-
-
-
-
diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
index 52ead45470..cc0e4d6b0a 100644
--- a/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
@@ -99,7 +99,8 @@ CREATE TABLE alf_access_control_entry
CREATE TABLE alf_acl_change_set
(
id BIGINT NOT NULL AUTO_INCREMENT,
- version BIGINT NOT NULL,
+ commit_time_ms BIGINT,
+ KEY idx_alf_acs_ctms (commit_time_ms)
PRIMARY KEY (id)
) ENGINE=InnoDB;
diff --git a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
index 7422996a08..cbcebf639d 100644
--- a/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
+++ b/config/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
@@ -106,9 +106,10 @@ CREATE SEQUENCE alf_acl_change_set_seq START WITH 1 INCREMENT BY 1;
CREATE TABLE alf_acl_change_set
(
id INT8 NOT NULL,
- version INT8 NOT NULL,
+ commit_time_ms INT8,
PRIMARY KEY (id)
);
+CREATE INDEX idx_alf_acs_ctms ON alf_acl_change_set (commit_time_ms);
CREATE SEQUENCE alf_access_control_list_seq START WITH 1 INCREMENT BY 1;
CREATE TABLE alf_access_control_list
diff --git a/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.MySQLInnoDBDialect/AclChangeSet-Tracking.sql b/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.MySQLInnoDBDialect/AclChangeSet-Tracking.sql
new file mode 100644
index 0000000000..d7c823979b
--- /dev/null
+++ b/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.MySQLInnoDBDialect/AclChangeSet-Tracking.sql
@@ -0,0 +1,36 @@
+--
+-- Title: Update ACL Change Set for Change Tracking
+-- Database: MySQL
+-- Since: V4.0 Schema 5008
+-- Author: Derek Hulley
+--
+-- Please contact support@alfresco.com if you need assistance with the upgrade.
+--
+
+-- Rename redundant 'version' to indexed 'commit_time_ms'
+ALTER TABLE alf_acl_change_set
+ CHANGE COLUMN version commit_time_ms BIGINT(20) NULL;
+
+-- Fill with data
+--FOREACH alf_acl_change_set.id system.upgrade.alf_acl_change_set.batchsize
+UPDATE alf_acl_change_set
+ SET
+ commit_time_ms = id
+ WHERE
+ id >= ${LOWERBOUND} AND id <= ${UPPERBOUND}
+;
+
+-- Add index on new data
+CREATE INDEX idx_alf_acs_ctms ON alf_acl_change_set (commit_time_ms);
+
+--
+-- Record script finish
+--
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.0-AclChangeSet';
+INSERT INTO alf_applied_patch
+ (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
+ VALUES
+ (
+ 'patch.db-V4.0-AclChangeSet', 'Manually executed script upgrade V4.0: Update ACL Change Set for Change Tracking',
+ 0, 5007, -1, 5008, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
+ );
\ No newline at end of file
diff --git a/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.PostgreSQLDialect/AclChangeSet-Tracking.sql b/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.PostgreSQLDialect/AclChangeSet-Tracking.sql
new file mode 100644
index 0000000000..28db644a26
--- /dev/null
+++ b/config/alfresco/dbscripts/upgrade/4.0/org.hibernate.dialect.PostgreSQLDialect/AclChangeSet-Tracking.sql
@@ -0,0 +1,38 @@
+--
+-- Title: Update ACL Change Set for Change Tracking
+-- Database: PostgreSQL
+-- Since: V4.0 Schema 5008
+-- Author: Derek Hulley
+--
+-- Please contact support@alfresco.com if you need assistance with the upgrade.
+--
+
+-- Rename redundant 'version' to indexed 'commit_time_ms'
+ALTER TABLE alf_acl_change_set
+ RENAME "version" TO commit_time_ms;
+ALTER TABLE alf_acl_change_set
+ ALTER COLUMN commit_time_ms DROP NOT NULL;
+
+-- Fill with data
+--FOREACH alf_acl_change_set.id system.upgrade.alf_acl_change_set.batchsize
+UPDATE alf_acl_change_set
+ SET
+ commit_time_ms = id
+ WHERE
+ id >= ${LOWERBOUND} AND id <= ${UPPERBOUND}
+;
+
+-- Add index on new data
+CREATE INDEX idx_alf_acs_ctms ON alf_acl_change_set (commit_time_ms);
+
+--
+-- Record script finish
+--
+DELETE FROM alf_applied_patch WHERE id = 'patch.db-V4.0-AclChangeSet';
+INSERT INTO alf_applied_patch
+ (id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
+ VALUES
+ (
+ 'patch.db-V4.0-AclChangeSet', 'Manually executed script upgrade V4.0: Update ACL Change Set for Change Tracking',
+ 0, 5007, -1, 5008, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
+ );
\ No newline at end of file
diff --git a/config/alfresco/ibatis/alfresco-SqlMapConfig.xml b/config/alfresco/ibatis/alfresco-SqlMapConfig.xml
index 4b526d63d4..537bfa59f4 100644
--- a/config/alfresco/ibatis/alfresco-SqlMapConfig.xml
+++ b/config/alfresco/ibatis/alfresco-SqlMapConfig.xml
@@ -107,9 +107,9 @@ Inbound settings from iBatis
-
-
-
+
+
+
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/permissions-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/permissions-common-SqlMap.xml
index 78144f533d..ad07c5e162 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/permissions-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/permissions-common-SqlMap.xml
@@ -159,16 +159,16 @@
insert into alf_acl_change_set
- (version)
+ (commit_time_ms)
values
- (#{version})
+ (null)
insert into alf_acl_change_set
- (id, version)
+ (id, commit_time_ms)
values
- (#{id}, #{version})
+ (#{id}, null)
@@ -270,6 +270,16 @@
+
+
+ update
+ alf_acl_change_set
+ set
+ commit_time_ms = #{commitTimeMs,jdbcType=BIGINT}
+ where
+ id = #{id}
+
+
update
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml
index c572a62e75..046951ebc3 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/solr-common-SqlMap.xml
@@ -4,7 +4,7 @@
-
+
@@ -20,7 +20,7 @@
-