Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Commit
rt branch, 4.0/apply-scrips-to-multiple-queues, updated. rt-4.0.4-213-gec02d03
 

Index | Next | Previous | View Flat


trs at bestpractical

Apr 11, 2012, 2:44 PM


Views: 165
Permalink
rt branch, 4.0/apply-scrips-to-multiple-queues, updated. rt-4.0.4-213-gec02d03

The branch, 4.0/apply-scrips-to-multiple-queues has been updated
via ec02d03b170c784dcc2b69e8df5da8018d7294c7 (commit)
from 786484506b3bd56cca4b3508962de3d518d1b220 (commit)

Summary of changes:
etc/upgrade/{4.0.1 => 4.1.0}/acl.Pg | 14 +++-----------
etc/upgrade/4.1.0/{schema.mysql => schema.Pg} | 19 +++++++++++--------
2 files changed, 14 insertions(+), 19 deletions(-)
copy etc/upgrade/{4.0.1 => 4.1.0}/acl.Pg (67%)
copy etc/upgrade/4.1.0/{schema.mysql => schema.Pg} (71%)

- Log -----------------------------------------------------------------
commit ec02d03b170c784dcc2b69e8df5da8018d7294c7
Author: Thomas Sibley <trs [at] bestpractical>
Date: Tue Apr 10 17:41:55 2012 -0400

Schema upgrades for Postgres

diff --git a/etc/upgrade/4.1.0/acl.Pg b/etc/upgrade/4.1.0/acl.Pg
new file mode 100755
index 0000000..9e8fc0a
--- /dev/null
+++ b/etc/upgrade/4.1.0/acl.Pg
@@ -0,0 +1,31 @@
+
+sub acl {
+ my $dbh = shift;
+
+ my @acls;
+
+ my @tables = qw (
+ objectscrips_id_seq
+ ObjectScrips
+ );
+
+ my $db_user = RT->Config->Get('DatabaseUser');
+
+ my $sequence_right
+ = ( $dbh->{pg_server_version} >= 80200 )
+ ? "USAGE, SELECT, UPDATE"
+ : "SELECT, UPDATE";
+
+ foreach my $table (@tables) {
+ # Tables are upper-case, sequences are lowercase in @tables
+ if ( $table =~ /^[a-z]/ ) {
+ push @acls, "GRANT $sequence_right ON $table TO \"$db_user\";"
+ }
+ else {
+ push @acls, "GRANT SELECT, INSERT, UPDATE, DELETE ON $table TO \"$db_user\";"
+ }
+ }
+ return (@acls);
+}
+
+1;
diff --git a/etc/upgrade/4.1.0/schema.Pg b/etc/upgrade/4.1.0/schema.Pg
new file mode 100644
index 0000000..5865866
--- /dev/null
+++ b/etc/upgrade/4.1.0/schema.Pg
@@ -0,0 +1,41 @@
+CREATE SEQUENCE objectscrips_id_seq;
+
+CREATE TABLE ObjectScrips (
+ id INTEGER DEFAULT nextval('objectscrips_id_seq'),
+ Scrip integer NOT NULL,
+ Stage varchar(32) NOT NULL DEFAULT 'TransactionCreate' ,
+ ObjectId integer NOT NULL,
+ SortOrder integer NOT NULL DEFAULT 0 ,
+ Disabled integer NOT NULL DEFAULT 0 ,
+
+ Creator integer NOT NULL DEFAULT 0 ,
+ Created TIMESTAMP NULL ,
+ LastUpdatedBy integer NOT NULL DEFAULT 0 ,
+ LastUpdated TIMESTAMP NULL ,
+ PRIMARY KEY (id)
+
+);
+
+INSERT INTO ObjectScrips(
+ Scrip, Stage, ObjectId,
+ Creator, Created, LastUpdatedBy, LastUpdated
+)
+SELECT id, Stage, Queue, Creator, Created, LastUpdatedBy, LastUpdated
+FROM Scrips
+;
+
+UPDATE ObjectScrips SET Disabled = 1 WHERE Scrip IN (
+ SELECT id FROM Scrips WHERE Stage = 'Disabled'
+);
+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 ObjectCustomFields ADD COLUMN Disabled integer NOT NULL DEFAULT 0;
+UPDATE ObjectCustomFields SET Disabled = 1 WHERE CustomField IN (
+ SELECT id FROM CustomFields WHERE Disabled != 0
+);
+ALTER TABLE CustomFields DROP COLUMN Disabled;

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit [at] lists
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit

Subject User Time
rt branch, 4.0/apply-scrips-to-multiple-queues, updated. rt-4.0.4-213-gec02d03 trs at bestpractical Apr 11, 2012, 2:44 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.