diff --git a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
index 76a1107baa..f106adb6a8 100644
--- a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
+++ b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/AlfrescoCreate-RepoTables.sql
@@ -162,16 +162,28 @@ CREATE TABLE alf_authority_alias
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
) ENGINE=InnoDB;
+CREATE TABLE alf_server
+(
+ id BIGINT NOT NULL AUTO_INCREMENT,
+ version BIGINT NOT NULL,
+ ip_address VARCHAR(39) NOT NULL,
+ PRIMARY KEY (id),
+ UNIQUE KEY ip_address (ip_address)
+) ENGINE=InnoDB;
+
CREATE TABLE alf_transaction
(
id BIGINT NOT NULL AUTO_INCREMENT,
version BIGINT NOT NULL,
+ server_id BIGINT,
change_txn_id VARCHAR(56) NOT NULL,
commit_time_ms BIGINT,
PRIMARY KEY (id),
KEY idx_alf_txn_ctms (commit_time_ms, id),
KEY idx_alf_txn_ctms_sc (commit_time_ms),
- key idx_alf_txn_id_ctms (id, commit_time_ms)
+ key idx_alf_txn_id_ctms (id, commit_time_ms),
+ KEY fk_alf_txn_svr (server_id),
+ CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
) ENGINE=InnoDB;
CREATE TABLE alf_store
diff --git a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
index 600f35900b..09b0fc371b 100644
--- a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
+++ b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/Schema-Reference-ALF.xml
@@ -2472,7 +2472,39 @@
local_name
-
+
+
+
+
+
+ bigint
+ false
+ true
+
+
+ bigint
+ false
+ false
+
+
+ varchar(39)
+ false
+ false
+
+
+
+
+ id
+
+
+
+
+
+
+ ip_address
+
+
+
@@ -2620,12 +2652,17 @@
false
false
-
+
+ bigint
+ true
+ false
+
+
varchar(56)
false
false
-
+
bigint
true
false
@@ -2636,6 +2673,13 @@
id
+
+
+ server_id
+ alf_server
+ id
+
+
@@ -2654,6 +2698,11 @@
commit_time_ms
+
+
+ server_id
+
+
diff --git a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
index 364625ea54..b5176f5fa6 100644
--- a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
+++ b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/AlfrescoCreate-RepoTables.sql
@@ -29,7 +29,7 @@ CREATE TABLE alf_locale
id INT8 NOT NULL,
version INT8 NOT NULL,
locale_str VARCHAR(20) NOT NULL,
- PRIMARY KEY (id)
+ PRIMARY KEY (id)
);
CREATE UNIQUE INDEX locale_str ON alf_locale (locale_str);
@@ -50,7 +50,7 @@ CREATE TABLE alf_qname
version INT8 NOT NULL,
ns_id INT8 NOT NULL,
local_name VARCHAR(200) NOT NULL,
- CONSTRAINT fk_alf_qname_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id),
+ CONSTRAINT fk_alf_qname_ns FOREIGN KEY (ns_id) REFERENCES alf_namespace (id),
PRIMARY KEY (id)
);
CREATE UNIQUE INDEX ns_id ON alf_qname (ns_id, local_name);
@@ -62,7 +62,7 @@ CREATE TABLE alf_permission
version INT8 NOT NULL,
type_qname_id INT8 NOT NULL,
name VARCHAR(100) NOT NULL,
- PRIMARY KEY (id),
+ PRIMARY KEY (id),
CONSTRAINT fk_alf_perm_tqn FOREIGN KEY (type_qname_id) REFERENCES alf_qname (id)
);
CREATE UNIQUE INDEX type_qname_id ON alf_permission (type_qname_id, name);
@@ -101,7 +101,7 @@ CREATE TABLE alf_access_control_entry
allowed BOOL NOT NULL,
applies INT4 NOT NULL,
context_id INT8,
- PRIMARY KEY (id),
+ PRIMARY KEY (id),
CONSTRAINT fk_alf_ace_auth FOREIGN KEY (authority_id) REFERENCES alf_authority (id),
CONSTRAINT fk_alf_ace_ctx FOREIGN KEY (context_id) REFERENCES alf_ace_context (id),
CONSTRAINT fk_alf_ace_perm FOREIGN KEY (permission_id) REFERENCES alf_permission (id)
@@ -151,7 +151,7 @@ CREATE TABLE alf_acl_member
acl_id INT8 NOT NULL,
ace_id INT8 NOT NULL,
pos INT4 NOT NULL,
- PRIMARY KEY (id),
+ PRIMARY KEY (id),
CONSTRAINT fk_alf_aclm_ace FOREIGN KEY (ace_id) REFERENCES alf_access_control_entry (id),
CONSTRAINT fk_alf_aclm_acl FOREIGN KEY (acl_id) REFERENCES alf_access_control_list (id)
);
@@ -174,18 +174,31 @@ CREATE UNIQUE INDEX auth_id ON alf_authority_alias (auth_id, alias_id);
CREATE INDEX fk_alf_autha_ali ON alf_authority_alias (alias_id);
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_id);
+CREATE SEQUENCE alf_server_seq START WITH 1 INCREMENT BY 1;
+CREATE TABLE alf_server
+(
+ id INT8 NOT NULL,
+ version INT8 NOT NULL,
+ ip_address VARCHAR(39) NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE UNIQUE INDEX ip_address ON alf_server (ip_address);
+
CREATE SEQUENCE alf_transaction_seq START WITH 1 INCREMENT BY 1;
CREATE TABLE alf_transaction
(
id INT8 NOT NULL,
version INT8 NOT NULL,
+ server_id INT8,
change_txn_id VARCHAR(56) NOT NULL,
commit_time_ms INT8,
- PRIMARY KEY (id)
+ PRIMARY KEY (id),
+ CONSTRAINT fk_alf_txn_svr FOREIGN KEY (server_id) REFERENCES alf_server (id)
);
CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
CREATE INDEX idx_alf_txn_ctms_sc ON alf_transaction (commit_time_ms);
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, commit_time_ms);
+CREATE INDEX fk_alf_txn_svr ON alf_transaction (server_id);
CREATE SEQUENCE alf_store_seq START WITH 1 INCREMENT BY 1;
CREATE TABLE alf_store
@@ -254,7 +267,7 @@ CREATE TABLE alf_child_assoc
qname_crc INT8 NOT NULL,
is_primary BOOL,
assoc_index INT4,
- PRIMARY KEY (id),
+ PRIMARY KEY (id),
CONSTRAINT fk_alf_cass_cnode FOREIGN KEY (child_node_id) REFERENCES alf_node (id),
CONSTRAINT fk_alf_cass_pnode FOREIGN KEY (parent_node_id) REFERENCES alf_node (id),
CONSTRAINT fk_alf_cass_qnns FOREIGN KEY (qname_ns_id) REFERENCES alf_namespace (id),
@@ -273,7 +286,7 @@ CREATE TABLE alf_node_aspects
node_id INT8 NOT NULL,
qname_id INT8 NOT NULL,
PRIMARY KEY (node_id, qname_id),
- CONSTRAINT fk_alf_nasp_n FOREIGN KEY (node_id) REFERENCES alf_node (id),
+ CONSTRAINT fk_alf_nasp_n FOREIGN KEY (node_id) REFERENCES alf_node (id),
CONSTRAINT fk_alf_nasp_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id)
);
CREATE INDEX fk_alf_nasp_n ON alf_node_aspects (node_id);
@@ -288,7 +301,7 @@ CREATE TABLE alf_node_assoc
target_node_id INT8 NOT NULL,
type_qname_id INT8 NOT NULL,
assoc_index INT8 NOT NULL,
- PRIMARY KEY (id),
+ PRIMARY KEY (id),
CONSTRAINT fk_alf_nass_snode FOREIGN KEY (source_node_id) REFERENCES alf_node (id),
CONSTRAINT fk_alf_nass_tnode FOREIGN KEY (target_node_id) REFERENCES alf_node (id),
CONSTRAINT fk_alf_nass_tqn FOREIGN KEY (type_qname_id) REFERENCES alf_qname (id)
diff --git a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
index 312c35c6d5..9b549e4ec5 100644
--- a/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
+++ b/repository/src/main/resources/alfresco/dbscripts/create/org.alfresco.repo.domain.dialect.PostgreSQLDialect/Schema-Reference-ALF.xml
@@ -44,6 +44,7 @@
+
@@ -912,45 +913,45 @@
-
-
-
- int8
- false
- false
-
-
- varchar(100)
- false
- false
-
-
- bool
- false
- false
-
-
- bool
- false
- false
-
-
- bytea
- false
- false
-
-
- varchar(10)
- false
- false
-
-
-
-
- id
-
-
-
+
+
+
+ int8
+ false
+ false
+
+
+ varchar(100)
+ false
+ false
+
+
+ bool
+ false
+ false
+
+
+ bool
+ false
+ false
+
+
+ bytea
+ false
+ false
+
+
+ varchar(10)
+ false
+ false
+
+
+
+
+ id
+
+
+
username
@@ -959,7 +960,7 @@
- deleted
+ deleted
@@ -967,9 +968,9 @@
authaction
-
-
-
+
+
+
@@ -1628,11 +1629,11 @@
-
-
- alf_node_pkey1?
-
-
+
+
+ alf_node_pkey1?
+
+
id
@@ -1830,11 +1831,11 @@
-
-
- alf_node_assoc_pkey1?
-
-
+
+
+ alf_node_assoc_pkey1?
+
+
id
@@ -2542,7 +2543,39 @@
local_name
-
+
+
+
+
+
+ int8
+ false
+ false
+
+
+ int8
+ false
+ false
+
+
+ varchar(39)
+ false
+ false
+
+
+
+
+ id
+
+
+
+
+
+
+ ip_address
+
+
+
@@ -2690,12 +2723,17 @@
false
false
-
+
+ int8
+ true
+ false
+
+
varchar(56)
false
false
-
+
int8
true
false
@@ -2706,7 +2744,19 @@
id
+
+
+ server_id
+ alf_server
+ id
+
+
+
+
+ server_id
+
+
commit_time_ms
diff --git a/repository/src/main/resources/alfresco/dbscripts/db-schema-context.xml b/repository/src/main/resources/alfresco/dbscripts/db-schema-context.xml
index 786ff0e5d0..f646454b35 100644
--- a/repository/src/main/resources/alfresco/dbscripts/db-schema-context.xml
+++ b/repository/src/main/resources/alfresco/dbscripts/db-schema-context.xml
@@ -54,7 +54,6 @@
-
diff --git a/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/remove-alf_server-table.sql b/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/remove-alf_server-table.sql
deleted file mode 100644
index e9bbe2aa57..0000000000
--- a/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.MySQLInnoDBDialect/remove-alf_server-table.sql
+++ /dev/null
@@ -1,31 +0,0 @@
---
--- Title: Remove alf_server table
--- Database: MySQL
--- Since: V6.3
--- Author: David Edwards
--- Author: Alex Mukha
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
-
-SET FOREIGN_KEY_CHECKS=0;
-
-DROP TABLE alf_server;
-
-ALTER TABLE alf_transaction
- DROP FOREIGN KEY fk_alf_txn_svr,
- DROP COLUMN server_id;
-
-SET FOREIGN_KEY_CHECKS=1;
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V6.3-remove-alf_server-table';
-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-V6.3-remove-alf_server-table', 'Remove alf_server table',
- 0, 14000, -1, 14001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
- );
\ No newline at end of file
diff --git a/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.PostgreSQLDialect/remove-alf_server-table.sql b/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.PostgreSQLDialect/remove-alf_server-table.sql
deleted file mode 100644
index 0662099fc8..0000000000
--- a/repository/src/main/resources/alfresco/dbscripts/upgrade/6.3/org.alfresco.repo.domain.dialect.PostgreSQLDialect/remove-alf_server-table.sql
+++ /dev/null
@@ -1,64 +0,0 @@
---
--- Title: Remove alf_server table
--- Database: PostgreSQL
--- Since: V6.3
--- Author: David Edwards
--- Author: Alex Mukha
---
--- Please contact support@alfresco.com if you need assistance with the upgrade.
---
-
--- DROP the indexes
-DROP INDEX fk_alf_txn_svr;
-DROP INDEX idx_alf_txn_ctms;
-
--- DROP the constraints alf_transaction
-ALTER TABLE alf_transaction DROP CONSTRAINT fk_alf_txn_svr;
-
--- Rename existing alf_transaction to t_alf_transaction
-ALTER TABLE alf_transaction RENAME TO t_alf_transaction;
-
--- Create new alf_transaction table with new schema
-CREATE TABLE alf_transaction
-(
- id INT8 NOT NULL,
- version INT8 NOT NULL,
- change_txn_id VARCHAR(56) NOT NULL,
- commit_time_ms INT8,
- PRIMARY KEY (id)
-);
-CREATE INDEX idx_alf_txn_ctms ON alf_transaction (commit_time_ms, id);
-
-
---FOREACH t_alf_transaction.id system.upgrade.alf_server_deleted.batchsize
-INSERT INTO alf_transaction
-(id, version, change_txn_id, commit_time_ms)
-(
- SELECT
- id, version, change_txn_id, commit_time_ms
- FROM
- t_alf_transaction
- WHERE
- id >= ${LOWERBOUND} AND id <= ${UPPERBOUND}
-);
-
--- DROP existing fk constraint from alf_node ADD a new reference to the new alf_transaction table
-ALTER TABLE alf_node
- DROP CONSTRAINT fk_alf_node_txn,
- ADD CONSTRAINT fk_alf_node_txn FOREIGN KEY (transaction_id)
- REFERENCES alf_transaction (id);
-
-DROP TABLE t_alf_transaction;
-DROP TABLE alf_server;
-
---
--- Record script finish
---
-DELETE FROM alf_applied_patch WHERE id = 'patch.db-V6.3-remove-alf_server-table';
-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-V6.3-remove-alf_server-table', 'Remove alf_server table',
- 0, 14000, -1, 14001, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
- );
\ No newline at end of file
diff --git a/repository/src/main/resources/alfresco/messages/patch-service.properties b/repository/src/main/resources/alfresco/messages/patch-service.properties
index 915718a744..49682fd571 100644
--- a/repository/src/main/resources/alfresco/messages/patch-service.properties
+++ b/repository/src/main/resources/alfresco/messages/patch-service.properties
@@ -402,6 +402,4 @@ patch.db-V5.2-remove-jbpm-tables-from-db.description=Removes all JBPM related ta
patch.db-V6.0-change-set-indexes.description=Add additional indexes to support acl tracking.
-patch.db-V6.3-remove-alf_server-table.description=Remove alf_server table.
-
patch.db-V6.3-add-indexes-node-transaction.description=Create additional indexes on alf_node and alf_transaction
\ No newline at end of file
diff --git a/repository/src/main/resources/alfresco/patch/patch-services-context.xml b/repository/src/main/resources/alfresco/patch/patch-services-context.xml
index 6bc9a5a6a4..6d78a839ca 100644
--- a/repository/src/main/resources/alfresco/patch/patch-services-context.xml
+++ b/repository/src/main/resources/alfresco/patch/patch-services-context.xml
@@ -1397,17 +1397,6 @@
classpath:alfresco/dbscripts/upgrade/6.0/${db.script.dialect}/change-set-indexes.sql
-
-
- patch.db-V6.3-remove-alf_server-table
- patch.db-V6.3-remove-alf_server-table.description
- 0
- 14000
- 14001
-
- classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/remove-alf_server-table.sql
-
-
patch.db-V6.3-add-indexes-node-transaction