mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ACS-855 : Long running patch in ACS 7.0.0.A2 upgrade (#338)
- revert changes (sql and schema reference files) done in REPO-4547
This commit is contained in:
@@ -162,16 +162,28 @@ CREATE TABLE alf_authority_alias
|
|||||||
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
|
CONSTRAINT fk_alf_autha_ali FOREIGN KEY (alias_id) REFERENCES alf_authority (id)
|
||||||
) ENGINE=InnoDB;
|
) 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
|
CREATE TABLE alf_transaction
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
version BIGINT NOT NULL,
|
version BIGINT NOT NULL,
|
||||||
|
server_id BIGINT,
|
||||||
change_txn_id VARCHAR(56) NOT NULL,
|
change_txn_id VARCHAR(56) NOT NULL,
|
||||||
commit_time_ms BIGINT,
|
commit_time_ms BIGINT,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
KEY idx_alf_txn_ctms (commit_time_ms, id),
|
KEY idx_alf_txn_ctms (commit_time_ms, id),
|
||||||
KEY idx_alf_txn_ctms_sc (commit_time_ms),
|
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;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
CREATE TABLE alf_store
|
CREATE TABLE alf_store
|
||||||
|
@@ -2474,6 +2474,38 @@
|
|||||||
</index>
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
|
<table name="alf_server">
|
||||||
|
<columns>
|
||||||
|
<column name="id" order="1">
|
||||||
|
<type>bigint</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>true</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="version" order="2">
|
||||||
|
<type>bigint</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="ip_address" order="3">
|
||||||
|
<type>varchar(39)</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
</columns>
|
||||||
|
<primarykey name="PRIMARY">
|
||||||
|
<columnnames>
|
||||||
|
<columnname order="1">id</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</primarykey>
|
||||||
|
<foreignkeys/>
|
||||||
|
<indexes>
|
||||||
|
<index name="ip_address" unique="true">
|
||||||
|
<columnnames>
|
||||||
|
<columnname>ip_address</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</index>
|
||||||
|
</indexes>
|
||||||
|
</table>
|
||||||
<table name="alf_store">
|
<table name="alf_store">
|
||||||
<columns>
|
<columns>
|
||||||
<column name="id" order="1">
|
<column name="id" order="1">
|
||||||
@@ -2620,12 +2652,17 @@
|
|||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="change_txn_id" order="3">
|
<column name="server_id" order="3">
|
||||||
|
<type>bigint</type>
|
||||||
|
<nullable>true</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="change_txn_id" order="4">
|
||||||
<type>varchar(56)</type>
|
<type>varchar(56)</type>
|
||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="commit_time_ms" order="4">
|
<column name="commit_time_ms" order="5">
|
||||||
<type>bigint</type>
|
<type>bigint</type>
|
||||||
<nullable>true</nullable>
|
<nullable>true</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
@@ -2636,6 +2673,13 @@
|
|||||||
<columnname order="1">id</columnname>
|
<columnname order="1">id</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</primarykey>
|
</primarykey>
|
||||||
|
<foreignkeys>
|
||||||
|
<foreignkey name="fk_alf_txn_svr">
|
||||||
|
<localcolumn>server_id</localcolumn>
|
||||||
|
<targettable>alf_server</targettable>
|
||||||
|
<targetcolumn>id</targetcolumn>
|
||||||
|
</foreignkey>
|
||||||
|
</foreignkeys>
|
||||||
<indexes>
|
<indexes>
|
||||||
<index name="idx_alf_txn_ctms" unique="false">
|
<index name="idx_alf_txn_ctms" unique="false">
|
||||||
<columnnames>
|
<columnnames>
|
||||||
@@ -2654,6 +2698,11 @@
|
|||||||
<columnname>commit_time_ms</columnname>
|
<columnname>commit_time_ms</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</index>
|
</index>
|
||||||
|
<index name="fk_alf_txn_svr" unique="false">
|
||||||
|
<columnnames>
|
||||||
|
<columnname>server_id</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
<table name="alf_usage_delta">
|
<table name="alf_usage_delta">
|
||||||
|
@@ -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_ali ON alf_authority_alias (alias_id);
|
||||||
CREATE INDEX fk_alf_autha_aut ON alf_authority_alias (auth_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 SEQUENCE alf_transaction_seq START WITH 1 INCREMENT BY 1;
|
||||||
CREATE TABLE alf_transaction
|
CREATE TABLE alf_transaction
|
||||||
(
|
(
|
||||||
id INT8 NOT NULL,
|
id INT8 NOT NULL,
|
||||||
version INT8 NOT NULL,
|
version INT8 NOT NULL,
|
||||||
|
server_id INT8,
|
||||||
change_txn_id VARCHAR(56) NOT NULL,
|
change_txn_id VARCHAR(56) NOT NULL,
|
||||||
commit_time_ms INT8,
|
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 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_ctms_sc ON alf_transaction (commit_time_ms);
|
||||||
CREATE INDEX idx_alf_txn_id_ctms ON alf_transaction (id, 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 SEQUENCE alf_store_seq START WITH 1 INCREMENT BY 1;
|
||||||
CREATE TABLE alf_store
|
CREATE TABLE alf_store
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
<sequence name="alf_prop_unique_ctx_seq"/>
|
<sequence name="alf_prop_unique_ctx_seq"/>
|
||||||
<sequence name="alf_prop_value_seq"/>
|
<sequence name="alf_prop_value_seq"/>
|
||||||
<sequence name="alf_qname_seq"/>
|
<sequence name="alf_qname_seq"/>
|
||||||
|
<sequence name="alf_server_seq"/>
|
||||||
<sequence name="alf_store_seq"/>
|
<sequence name="alf_store_seq"/>
|
||||||
<sequence name="alf_transaction_seq"/>
|
<sequence name="alf_transaction_seq"/>
|
||||||
<sequence name="alf_usage_delta_seq"/>
|
<sequence name="alf_usage_delta_seq"/>
|
||||||
@@ -2544,6 +2545,38 @@
|
|||||||
</index>
|
</index>
|
||||||
</indexes>
|
</indexes>
|
||||||
</table>
|
</table>
|
||||||
|
<table name="alf_server">
|
||||||
|
<columns>
|
||||||
|
<column name="id" order="1">
|
||||||
|
<type>int8</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="version" order="2">
|
||||||
|
<type>int8</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="ip_address" order="3">
|
||||||
|
<type>varchar(39)</type>
|
||||||
|
<nullable>false</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
</columns>
|
||||||
|
<primarykey name="alf_server_pkey">
|
||||||
|
<columnnames>
|
||||||
|
<columnname order="1">id</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</primarykey>
|
||||||
|
<foreignkeys/>
|
||||||
|
<indexes>
|
||||||
|
<index name="ip_address" unique="true">
|
||||||
|
<columnnames>
|
||||||
|
<columnname>ip_address</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</index>
|
||||||
|
</indexes>
|
||||||
|
</table>
|
||||||
<table name="alf_store">
|
<table name="alf_store">
|
||||||
<columns>
|
<columns>
|
||||||
<column name="id" order="1">
|
<column name="id" order="1">
|
||||||
@@ -2690,12 +2723,17 @@
|
|||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="change_txn_id" order="3">
|
<column name="server_id" order="3">
|
||||||
|
<type>int8</type>
|
||||||
|
<nullable>true</nullable>
|
||||||
|
<autoincrement>false</autoincrement>
|
||||||
|
</column>
|
||||||
|
<column name="change_txn_id" order="4">
|
||||||
<type>varchar(56)</type>
|
<type>varchar(56)</type>
|
||||||
<nullable>false</nullable>
|
<nullable>false</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
</column>
|
</column>
|
||||||
<column name="commit_time_ms" order="4">
|
<column name="commit_time_ms" order="5">
|
||||||
<type>int8</type>
|
<type>int8</type>
|
||||||
<nullable>true</nullable>
|
<nullable>true</nullable>
|
||||||
<autoincrement>false</autoincrement>
|
<autoincrement>false</autoincrement>
|
||||||
@@ -2706,7 +2744,19 @@
|
|||||||
<columnname order="1">id</columnname>
|
<columnname order="1">id</columnname>
|
||||||
</columnnames>
|
</columnnames>
|
||||||
</primarykey>
|
</primarykey>
|
||||||
|
<foreignkeys>
|
||||||
|
<foreignkey name="fk_alf_txn_svr">
|
||||||
|
<localcolumn>server_id</localcolumn>
|
||||||
|
<targettable>alf_server</targettable>
|
||||||
|
<targetcolumn>id</targetcolumn>
|
||||||
|
</foreignkey>
|
||||||
|
</foreignkeys>
|
||||||
<indexes>
|
<indexes>
|
||||||
|
<index name="fk_alf_txn_svr" unique="false">
|
||||||
|
<columnnames>
|
||||||
|
<columnname>server_id</columnname>
|
||||||
|
</columnnames>
|
||||||
|
</index>
|
||||||
<index name="idx_alf_txn_ctms" unique="false">
|
<index name="idx_alf_txn_ctms" unique="false">
|
||||||
<columnnames>
|
<columnnames>
|
||||||
<columnname>commit_time_ms</columnname>
|
<columnname>commit_time_ms</columnname>
|
||||||
|
@@ -54,7 +54,6 @@
|
|||||||
<ref bean="patch.db-V5.1-metadata-query-indexes" />
|
<ref bean="patch.db-V5.1-metadata-query-indexes" />
|
||||||
<ref bean="patch.db-V5.2-remove-jbpm-tables-from-db" />
|
<ref bean="patch.db-V5.2-remove-jbpm-tables-from-db" />
|
||||||
<ref bean="patch.db-V6.0-change-set-indexes" />
|
<ref bean="patch.db-V6.0-change-set-indexes" />
|
||||||
<ref bean="patch.db-V6.3-remove-alf_server-table" />
|
|
||||||
<ref bean="patch.db-V6.3-add-indexes-node-transaction" />
|
<ref bean="patch.db-V6.3-add-indexes-node-transaction" />
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -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'
|
|
||||||
);
|
|
@@ -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'
|
|
||||||
);
|
|
@@ -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.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
|
patch.db-V6.3-add-indexes-node-transaction.description=Create additional indexes on alf_node and alf_transaction
|
@@ -1398,17 +1398,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="patch.db-V6.3-remove-alf_server-table" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
|
||||||
<property name="id"><value>patch.db-V6.3-remove-alf_server-table</value></property>
|
|
||||||
<property name="description"><value>patch.db-V6.3-remove-alf_server-table.description</value></property>
|
|
||||||
<property name="fixesFromSchema"><value>0</value></property>
|
|
||||||
<property name="fixesToSchema"><value>14000</value></property>
|
|
||||||
<property name="targetSchema"><value>14001</value></property>
|
|
||||||
<property name="scriptUrl">
|
|
||||||
<value>classpath:alfresco/dbscripts/upgrade/6.3/${db.script.dialect}/remove-alf_server-table.sql</value>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="patch.db-V6.3-add-indexes-node-transaction" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
<bean id="patch.db-V6.3-add-indexes-node-transaction" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||||
<property name="id"><value>patch.db-V6.3-add-indexes-node-transaction</value></property>
|
<property name="id"><value>patch.db-V6.3-add-indexes-node-transaction</value></property>
|
||||||
<property name="description"><value>patch.db-V6.3-add-indexes-node-transaction.description</value></property>
|
<property name="description"><value>patch.db-V6.3-add-indexes-node-transaction.description</value></property>
|
||||||
|
Reference in New Issue
Block a user