1 alter Table Transactions ADD Column (ObjectType varchar(64) not null);
2 update Transactions set ObjectType = 'RT::Ticket';
3 alter table Transactions drop column EffectiveTicket;
4 alter table Transactions add column ReferenceType varchar(255) NULL;
5 alter table Transactions add column OldReference integer NULL;
6 alter table Transactions add column NewReference integer NULL;
7 alter table Transactions drop index transactions1;
8 alter table Transactions change Ticket ObjectId integer NOT NULL DEFAULT 0 ;
10 CREATE INDEX Transactions1 ON Transactions (ObjectType, ObjectId);
12 alter table TicketCustomFieldValues rename ObjectCustomFieldValues;
14 alter table ObjectCustomFieldValues change Ticket ObjectId integer NOT NULL DEFAULT 0 ;
16 alter table ObjectCustomFieldValues add column ObjectType varchar(255) not null;
18 update ObjectCustomFieldValues set ObjectType = 'RT::Ticket';
20 alter table ObjectCustomFieldValues add column Current bool default 1;
22 alter table ObjectCustomFieldValues add column LargeContent LONGTEXT NULL;
24 alter table ObjectCustomFieldValues add column ContentType varchar(80) NULL;
26 alter table ObjectCustomFieldValues add column ContentEncoding varchar(80) NULL;
28 # These could fail if there's no such index and there's no "drop index if exists" syntax
29 #alter table ObjectCustomFieldValues drop index ticketcustomfieldvalues1;
30 #alter table ObjectCustomFieldValues drop index ticketcustomfieldvalues2;
32 alter table ObjectCustomFieldValues add index ObjectCustomFieldValues1 (Content);
34 alter table ObjectCustomFieldValues add index ObjectCustomFieldValues2 (CustomField,ObjectType,ObjectId);
37 CREATE TABLE ObjectCustomFields (
38 id INTEGER NOT NULL AUTO_INCREMENT,
39 CustomField int NOT NULL ,
40 ObjectId integer NOT NULL,
41 SortOrder integer NOT NULL DEFAULT 0 ,
43 Creator integer NOT NULL DEFAULT 0 ,
44 Created DATETIME NULL ,
45 LastUpdatedBy integer NOT NULL DEFAULT 0 ,
46 LastUpdated DATETIME NULL ,
51 INSERT into ObjectCustomFields (id, CustomField, ObjectId, SortOrder, Creator, LastUpdatedBy) SELECT null, id, Queue, SortOrder, Creator, LastUpdatedBy from CustomFields;
53 alter table CustomFields add column LookupType varchar(255) NOT NULL;
54 alter table CustomFields add column Repeated int2 NOT NULL DEFAULT 0 ;
55 alter table CustomFields add column Pattern varchar(255) NULL;
56 alter table CustomFields add column MaxValues integer;
58 # alter table CustomFields drop index CustomFields1;
60 UPDATE CustomFields SET MaxValues = 0 WHERE Type LIKE '%Multiple';
61 UPDATE CustomFields SET MaxValues = 1 WHERE Type LIKE '%Single';
62 UPDATE CustomFields SET Type = 'Select' WHERE Type LIKE 'Select%';
63 UPDATE CustomFields SET Type = 'Freeform' WHERE Type LIKE 'Freeform%';
64 UPDATE CustomFields Set LookupType = 'RT::Queue-RT::Ticket';
65 alter table CustomFields drop column Queue;