Master to 4.2.8
[usit-rt.git] / etc / upgrade / 4.1.1 / schema.Pg
CommitLineData
c33a4027
MKG
1DROP TABLE IF EXISTS ObjectScrips;
2DROP SEQUENCE IF EXISTS objectscrips_id_seq;
af59614d 3
c33a4027 4CREATE SEQUENCE objectscrips_id_seq;
af59614d
MKG
5CREATE TABLE ObjectScrips (
6 id INTEGER DEFAULT nextval('objectscrips_id_seq'),
7 Scrip integer NOT NULL,
8 Stage varchar(32) NOT NULL DEFAULT 'TransactionCreate' ,
9 ObjectId integer NOT NULL,
10 SortOrder integer NOT NULL DEFAULT 0 ,
11
12 Creator integer NOT NULL DEFAULT 0 ,
13 Created TIMESTAMP NULL ,
14 LastUpdatedBy integer NOT NULL DEFAULT 0 ,
15 LastUpdated TIMESTAMP NULL ,
16 PRIMARY KEY (id)
17
18);
19ALTER TABLE Scrips ADD COLUMN Disabled int2 NOT NULL DEFAULT 0;
20
21INSERT INTO ObjectScrips(
22 Scrip, Stage, ObjectId,
23 Creator, Created, LastUpdatedBy, LastUpdated
24)
25SELECT id, Stage, Queue, Creator, Created, LastUpdatedBy, LastUpdated
26FROM Scrips
27;
28
29UPDATE Scrips SET Disabled = 1 WHERE Stage = 'Disabled';
30UPDATE ObjectScrips SET Stage = 'TransactionCreate' WHERE Stage = 'Disabled';
31
32CREATE UNIQUE INDEX ObjectScrips1 ON ObjectScrips (ObjectId, Scrip);
33
c33a4027
MKG
34ALTER TABLE Scrips
35 DROP COLUMN Stage,
36 DROP COLUMN Queue;