[Rt-commit] rt branch, 5.0/merge-attachments-schema-changes, created. rt-5.0.0alpha1-78-g23c7e900df

? sunnavy sunnavy at bestpractical.com
Fri Apr 3 16:04:28 EDT 2020


The branch, 5.0/merge-attachments-schema-changes has been created
        at  23c7e900dfffe0202aef4682c9e0ae5af03f16d0 (commit)

- Log -----------------------------------------------------------------
commit 23c7e900dfffe0202aef4682c9e0ae5af03f16d0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Apr 4 03:21:01 2020 +0800

    Merge multiple schema changes of Attachments into one SQL
    
    Attachments is a big table, and the performance is evidently better
    using one SQL. Besides that, it also could reduce disk space usage for
    databases that need to make table copies on schema changes.
    
    With this commit, we can be sure that required free disk space won't
    exceed the size of current database.

diff --git a/etc/upgrade/4.5.4/schema.Oracle b/etc/upgrade/4.5.4/schema.Oracle
index 6050d76b31..e70a909681 100644
--- a/etc/upgrade/4.5.4/schema.Oracle
+++ b/etc/upgrade/4.5.4/schema.Oracle
@@ -1,5 +1,3 @@
-ALTER TABLE Attachments MODIFY id            NUMBER(19,0);
-ALTER TABLE Attachments MODIFY TransactionId NUMBER(19,0);
-ALTER TABLE Attachments MODIFY Parent        NUMBER(19,0);
+ALTER TABLE Attachments MODIFY ( id NUMBER(19,0), TransactionId NUMBER(19,0), Parent NUMBER(19,0) );
 ALTER TABLE Transactions MODIFY id           NUMBER(19,0);
 ALTER TABLE ObjectCustomFieldValues MODIFY ObjectId NUMBER(19,0);
diff --git a/etc/upgrade/4.5.4/schema.Pg b/etc/upgrade/4.5.4/schema.Pg
index 381b06ec26..f875882c0f 100644
--- a/etc/upgrade/4.5.4/schema.Pg
+++ b/etc/upgrade/4.5.4/schema.Pg
@@ -1,5 +1,3 @@
-ALTER TABLE Attachments ALTER COLUMN id SET DATA TYPE BIGINT;
-ALTER TABLE Attachments ALTER COLUMN TransactionId SET DATA TYPE BIGINT;
-ALTER TABLE Attachments ALTER COLUMN Parent SET DATA TYPE BIGINT;
+ALTER TABLE Attachments ALTER COLUMN id SET DATA TYPE BIGINT, ALTER COLUMN TransactionId SET DATA TYPE BIGINT, ALTER COLUMN Parent SET DATA TYPE BIGINT;
 ALTER TABLE Transactions ALTER COLUMN id SET DATA TYPE BIGINT;
 ALTER TABLE ObjectCustomFieldValues ALTER COLUMN ObjectId SET DATA TYPE BIGINT;
diff --git a/etc/upgrade/4.5.4/schema.mysql b/etc/upgrade/4.5.4/schema.mysql
index 2f0d7a76d3..8472e0cfe4 100644
--- a/etc/upgrade/4.5.4/schema.mysql
+++ b/etc/upgrade/4.5.4/schema.mysql
@@ -1,5 +1,3 @@
-ALTER TABLE Attachments MODIFY id BIGINT NOT NULL AUTO_INCREMENT;
-ALTER TABLE Attachments MODIFY TransactionId BIGINT NOT NULL;
-ALTER TABLE Attachments MODIFY Parent BIGINT NOT NULL DEFAULT 0;
+ALTER TABLE Attachments MODIFY id BIGINT NOT NULL AUTO_INCREMENT, MODIFY TransactionId BIGINT NOT NULL, MODIFY Parent BIGINT NOT NULL DEFAULT 0;
 ALTER TABLE Transactions MODIFY id BIGINT NOT NULL AUTO_INCREMENT;
 ALTER TABLE ObjectCustomFieldValues MODIFY ObjectId BIGINT NOT NULL;

-----------------------------------------------------------------------


More information about the rt-commit mailing list