[Rt-commit] rt branch, 4.2/fewer-alter-table, created. rt-4.2.5-163-g952346e3
Alex Vandiver
alexmv at bestpractical.com
Wed Jul 16 11:31:12 EDT 2014
The branch, 4.2/fewer-alter-table has been created
at 952346e35542068daa9f0a77a5f56855304838c1 (commit)
- Log -----------------------------------------------------------------
commit 952346e35542068daa9f0a77a5f56855304838c1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Apr 18 16:21:27 2014 -0400
Reduce ALTER TABLE calls by adding/dropping multiple columns at once
Fixes I#21309.
diff --git a/etc/upgrade/3.9.3/schema.Oracle b/etc/upgrade/3.9.3/schema.Oracle
index 4ee50c4..6ca1bdf 100644
--- a/etc/upgrade/3.9.3/schema.Oracle
+++ b/etc/upgrade/3.9.3/schema.Oracle
@@ -1,2 +1 @@
-ALTER TABLE ACL DROP COLUMN DelegatedBy;
-ALTER TABLE ACL DROP COLUMN DelegatedFrom;
+ALTER TABLE ACL DROP( DelegatedBy, DelegatedFrom );
diff --git a/etc/upgrade/3.9.3/schema.Pg b/etc/upgrade/3.9.3/schema.Pg
index 4ee50c4..9b34ac7 100644
--- a/etc/upgrade/3.9.3/schema.Pg
+++ b/etc/upgrade/3.9.3/schema.Pg
@@ -1,2 +1,3 @@
-ALTER TABLE ACL DROP COLUMN DelegatedBy;
-ALTER TABLE ACL DROP COLUMN DelegatedFrom;
+ALTER TABLE ACL
+ DROP COLUMN DelegatedBy,
+ DROP COLUMN DelegatedFrom;
diff --git a/etc/upgrade/3.9.3/schema.mysql b/etc/upgrade/3.9.3/schema.mysql
index 4ee50c4..9b34ac7 100644
--- a/etc/upgrade/3.9.3/schema.mysql
+++ b/etc/upgrade/3.9.3/schema.mysql
@@ -1,2 +1,3 @@
-ALTER TABLE ACL DROP COLUMN DelegatedBy;
-ALTER TABLE ACL DROP COLUMN DelegatedFrom;
+ALTER TABLE ACL
+ DROP COLUMN DelegatedBy,
+ DROP COLUMN DelegatedFrom;
diff --git a/etc/upgrade/3.9.5/schema.Oracle b/etc/upgrade/3.9.5/schema.Oracle
index 065776d..bcf5b1f 100644
--- a/etc/upgrade/3.9.5/schema.Oracle
+++ b/etc/upgrade/3.9.5/schema.Oracle
@@ -6,15 +6,21 @@ AND CustomFieldValues.id = Attributes.ObjectId);
DELETE FROM Attributes WHERE Name = 'Category' AND ObjectType = 'RT::CustomFieldValue';
-ALTER TABLE Groups ADD Creator NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE Groups ADD Created DATE;
-ALTER TABLE Groups ADD LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE Groups ADD LastUpdated DATE;
-ALTER TABLE GroupMembers ADD Creator NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE GroupMembers ADD Created DATE;
-ALTER TABLE GroupMembers ADD LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE GroupMembers ADD LastUpdated DATE;
-ALTER TABLE ACL ADD Creator NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE ACL ADD Created DATE;
-ALTER TABLE ACL ADD LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL;
-ALTER TABLE ACL ADD LastUpdated DATE;
+ALTER TABLE Groups ADD(
+ Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
+ Created DATE,
+ LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
+ LastUpdated DATE
+);
+ALTER TABLE GroupMembers ADD(
+ Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
+ Created DATE,
+ LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
+ LastUpdated DATE
+);
+ALTER TABLE ACL ADD(
+ Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
+ Created DATE,
+ LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
+ LastUpdated DATE
+);
diff --git a/etc/upgrade/3.9.5/schema.Pg b/etc/upgrade/3.9.5/schema.Pg
index cea2c44..cd91901 100644
--- a/etc/upgrade/3.9.5/schema.Pg
+++ b/etc/upgrade/3.9.5/schema.Pg
@@ -6,15 +6,18 @@ AND CustomFieldValues.id = Attributes.ObjectId);
DELETE FROM Attributes WHERE Name = 'Category' AND ObjectType = 'RT::CustomFieldValue';
-ALTER TABLE Groups ADD COLUMN Creator integer NOT NULL DEFAULT 0;
-ALTER TABLE Groups ADD COLUMN Created TIMESTAMP NULL;
-ALTER TABLE Groups ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0;
-ALTER TABLE Groups ADD COLUMN LastUpdated TIMESTAMP NULL;
-ALTER TABLE GroupMembers ADD COLUMN Creator integer NOT NULL DEFAULT 0;
-ALTER TABLE GroupMembers ADD COLUMN Created TIMESTAMP NULL;
-ALTER TABLE GroupMembers ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0;
-ALTER TABLE GroupMembers ADD COLUMN LastUpdated TIMESTAMP NULL;
-ALTER TABLE ACL ADD COLUMN Creator integer NOT NULL DEFAULT 0;
-ALTER TABLE ACL ADD COLUMN Created TIMESTAMP NULL;
-ALTER TABLE ACL ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0;
-ALTER TABLE ACL ADD COLUMN LastUpdated TIMESTAMP NULL;
+ALTER TABLE Groups
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ ADD COLUMN Created TIMESTAMP NULL,
+ ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
+ ADD COLUMN LastUpdated TIMESTAMP NULL;
+ALTER TABLE GroupMembers
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ ADD COLUMN Created TIMESTAMP NULL,
+ ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
+ ADD COLUMN LastUpdated TIMESTAMP NULL;
+ALTER TABLE ACL
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ ADD COLUMN Created TIMESTAMP NULL,
+ ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
+ ADD COLUMN LastUpdated TIMESTAMP NULL;
diff --git a/etc/upgrade/3.9.5/schema.mysql b/etc/upgrade/3.9.5/schema.mysql
index fe5018c..83f2f40 100644
--- a/etc/upgrade/3.9.5/schema.mysql
+++ b/etc/upgrade/3.9.5/schema.mysql
@@ -6,15 +6,18 @@ AND CustomFieldValues.id = Attributes.ObjectId);
DELETE FROM Attributes WHERE Name = 'Category' AND ObjectType = 'RT::CustomFieldValue';
-ALTER TABLE Groups ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ALTER TABLE Groups
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
ADD COLUMN Created DATETIME NULL,
ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
ADD COLUMN LastUpdated DATETIME NULL;
-ALTER TABLE GroupMembers ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ALTER TABLE GroupMembers
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
ADD COLUMN Created DATETIME NULL,
ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
ADD COLUMN LastUpdated DATETIME NULL;
-ALTER TABLE ACL ADD COLUMN Creator integer NOT NULL DEFAULT 0,
+ALTER TABLE ACL
+ ADD COLUMN Creator integer NOT NULL DEFAULT 0,
ADD COLUMN Created DATETIME NULL,
ADD COLUMN LastUpdatedBy integer NOT NULL DEFAULT 0,
ADD COLUMN LastUpdated DATETIME NULL;
diff --git a/etc/upgrade/3.9.7/schema.Oracle b/etc/upgrade/3.9.7/schema.Oracle
index 3c75c91..70b4a12 100644
--- a/etc/upgrade/3.9.7/schema.Oracle
+++ b/etc/upgrade/3.9.7/schema.Oracle
@@ -1,6 +1,12 @@
ALTER TABLE Users ADD AuthToken VARCHAR2(16) NULL;
-ALTER TABLE CustomFields ADD BasedOn NUMBER(11,0) NULL;
-ALTER TABLE CustomFields ADD RenderType VARCHAR2(64) NULL;
-ALTER TABLE CustomFields ADD ValuesClass VARCHAR2(64) NULL;
-ALTER TABLE Queues ADD SubjectTag VARCHAR2(120) NULL;
-ALTER TABLE Queues ADD Lifecycle VARCHAR2(32) NULL;
+
+ALTER TABLE CustomFields ADD(
+ BasedOn NUMBER(11,0) NULL,
+ RenderType VARCHAR2(64) NULL,
+ ValuesClass VARCHAR2(64) NULL
+);
+
+ALTER TABLE Queues ADD(
+ SubjectTag VARCHAR2(120) NULL,
+ Lifecycle VARCHAR2(32) NULL
+);
diff --git a/etc/upgrade/3.9.7/schema.Pg b/etc/upgrade/3.9.7/schema.Pg
index 1704fa6..d6fe7cc 100644
--- a/etc/upgrade/3.9.7/schema.Pg
+++ b/etc/upgrade/3.9.7/schema.Pg
@@ -1,6 +1,10 @@
ALTER TABLE Users ADD COLUMN AuthToken VARCHAR(16) NULL;
-ALTER TABLE CustomFields ADD COLUMN BasedOn INTEGER NULL;
-ALTER TABLE CustomFields ADD COLUMN RenderType VARCHAR(64) NULL;
-ALTER TABLE CustomFields ADD COLUMN ValuesClass VARCHAR(64) NULL;
-ALTER TABLE Queues ADD COLUMN SubjectTag VARCHAR(120) NULL;
-ALTER TABLE Queues ADD COLUMN Lifecycle VARCHAR(32) NULL;
+
+ALTER TABLE CustomFields
+ ADD COLUMN BasedOn INTEGER NULL,
+ ADD COLUMN RenderType VARCHAR(64) NULL,
+ ADD COLUMN ValuesClass VARCHAR(64) NULL;
+
+ALTER TABLE Queues
+ ADD COLUMN SubjectTag VARCHAR(120) NULL,
+ ADD COLUMN Lifecycle VARCHAR(32) NULL;
diff --git a/etc/upgrade/3.9.7/schema.mysql b/etc/upgrade/3.9.7/schema.mysql
index 4cbed6c..0e61d64 100644
--- a/etc/upgrade/3.9.7/schema.mysql
+++ b/etc/upgrade/3.9.7/schema.mysql
@@ -1,6 +1,10 @@
ALTER TABLE Users ADD COLUMN AuthToken VARCHAR(16) CHARACTER SET ascii NULL;
-ALTER TABLE CustomFields ADD COLUMN BasedOn INTEGER NULL,
+
+ALTER TABLE CustomFields
+ ADD COLUMN BasedOn INTEGER NULL,
ADD COLUMN RenderType VARCHAR(64) NULL,
ADD COLUMN ValuesClass VARCHAR(64) CHARACTER SET ascii NULL;
-ALTER TABLE Queues ADD COLUMN SubjectTag VARCHAR(120) NULL,
+
+ALTER TABLE Queues
+ ADD COLUMN SubjectTag VARCHAR(120) NULL,
ADD COLUMN Lifecycle VARCHAR(32) NULL;
diff --git a/etc/upgrade/4.1.1/schema.Oracle b/etc/upgrade/4.1.1/schema.Oracle
index 4590585..33ea738 100644
--- a/etc/upgrade/4.1.1/schema.Oracle
+++ b/etc/upgrade/4.1.1/schema.Oracle
@@ -26,5 +26,4 @@ UPDATE ObjectScrips SET Stage = 'TransactionCreate' WHERE Stage = 'Disabled';
CREATE UNIQUE INDEX ObjectScrips1 ON ObjectScrips (ObjectId, Scrip);
-ALTER TABLE Scrips DROP COLUMN Stage;
-ALTER TABLE Scrips DROP COLUMN Queue;
+ALTER TABLE Scrips DROP( Stage, Queue );
diff --git a/etc/upgrade/4.1.1/schema.Pg b/etc/upgrade/4.1.1/schema.Pg
index f6949ab..91ba5a6 100644
--- a/etc/upgrade/4.1.1/schema.Pg
+++ b/etc/upgrade/4.1.1/schema.Pg
@@ -31,5 +31,6 @@ UPDATE ObjectScrips SET Stage = 'TransactionCreate' WHERE Stage = 'Disabled';
CREATE UNIQUE INDEX ObjectScrips1 ON ObjectScrips (ObjectId, Scrip);
-ALTER TABLE Scrips DROP COLUMN Stage;
-ALTER TABLE Scrips DROP COLUMN Queue;
+ALTER TABLE Scrips
+ DROP COLUMN Stage,
+ DROP COLUMN Queue;
diff --git a/etc/upgrade/4.1.1/schema.mysql b/etc/upgrade/4.1.1/schema.mysql
index 2420d98..82f3f84 100644
--- a/etc/upgrade/4.1.1/schema.mysql
+++ b/etc/upgrade/4.1.1/schema.mysql
@@ -27,5 +27,6 @@ UPDATE ObjectScrips SET Stage = 'TransactionCreate' WHERE Stage = 'Disabled';
CREATE UNIQUE INDEX ObjectScrips1 ON ObjectScrips (ObjectId, Scrip);
-ALTER TABLE Scrips DROP COLUMN Stage;
-ALTER TABLE Scrips DROP COLUMN Queue;
+ALTER TABLE Scrips
+ DROP COLUMN Stage,
+ DROP COLUMN Queue;
diff --git a/etc/upgrade/4.1.14/schema.Oracle b/etc/upgrade/4.1.14/schema.Oracle
index 5c4609c..f626093 100644
--- a/etc/upgrade/4.1.14/schema.Oracle
+++ b/etc/upgrade/4.1.14/schema.Oracle
@@ -1,2 +1 @@
-ALTER TABLE Scrips DROP COLUMN ConditionRules;
-ALTER TABLE Scrips DROP COLUMN ActionRules;
+ALTER TABLE Scrips DROP( ConditionRules, ActionRules );
diff --git a/etc/upgrade/4.1.14/schema.Pg b/etc/upgrade/4.1.14/schema.Pg
index 5c4609c..0b45d51 100644
--- a/etc/upgrade/4.1.14/schema.Pg
+++ b/etc/upgrade/4.1.14/schema.Pg
@@ -1,2 +1,3 @@
-ALTER TABLE Scrips DROP COLUMN ConditionRules;
-ALTER TABLE Scrips DROP COLUMN ActionRules;
+ALTER TABLE Scrips
+ DROP COLUMN ConditionRules,
+ DROP COLUMN ActionRules;
diff --git a/etc/upgrade/4.1.14/schema.mysql b/etc/upgrade/4.1.14/schema.mysql
index 5c4609c..0b45d51 100644
--- a/etc/upgrade/4.1.14/schema.mysql
+++ b/etc/upgrade/4.1.14/schema.mysql
@@ -1,2 +1,3 @@
-ALTER TABLE Scrips DROP COLUMN ConditionRules;
-ALTER TABLE Scrips DROP COLUMN ActionRules;
+ALTER TABLE Scrips
+ DROP COLUMN ConditionRules,
+ DROP COLUMN ActionRules;
diff --git a/etc/upgrade/4.1.19/schema.Oracle b/etc/upgrade/4.1.19/schema.Oracle
index 4e938e1..2371a5d 100644
--- a/etc/upgrade/4.1.19/schema.Oracle
+++ b/etc/upgrade/4.1.19/schema.Oracle
@@ -1,2 +1 @@
-ALTER TABLE Templates DROP COLUMN Language;
-ALTER TABLE Templates DROP COLUMN TranslationOf;
+ALTER TABLE Templates DROP( Language, TranslationOf );
diff --git a/etc/upgrade/4.1.19/schema.Pg b/etc/upgrade/4.1.19/schema.Pg
index 4e938e1..cfaa9a7 100644
--- a/etc/upgrade/4.1.19/schema.Pg
+++ b/etc/upgrade/4.1.19/schema.Pg
@@ -1,2 +1,3 @@
-ALTER TABLE Templates DROP COLUMN Language;
-ALTER TABLE Templates DROP COLUMN TranslationOf;
+ALTER TABLE Templates
+ DROP COLUMN Language,
+ DROP COLUMN TranslationOf;
diff --git a/etc/upgrade/4.1.19/schema.mysql b/etc/upgrade/4.1.19/schema.mysql
index 4e938e1..cfaa9a7 100644
--- a/etc/upgrade/4.1.19/schema.mysql
+++ b/etc/upgrade/4.1.19/schema.mysql
@@ -1,2 +1,3 @@
-ALTER TABLE Templates DROP COLUMN Language;
-ALTER TABLE Templates DROP COLUMN TranslationOf;
+ALTER TABLE Templates
+ DROP COLUMN Language,
+ DROP COLUMN TranslationOf;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list