X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fetc%2Fschema.Pg;h=32c5e872dd05e3bf382e9ad94cc4738d54c27c0b;hb=781e1d52be20355e1e9d57102d6ae44a3f1cbeeb;hp=a5b68b395175cb531efaec02b92f74dbbba66439;hpb=d39d52aac8f38ea9115628039f0df5aa3ac826de;p=freeside.git diff --git a/rt/etc/schema.Pg b/rt/etc/schema.Pg index a5b68b395..32c5e872d 100755 --- a/rt/etc/schema.Pg +++ b/rt/etc/schema.Pg @@ -57,7 +57,7 @@ CREATE TABLE Queues ( Created TIMESTAMP NULL , LastUpdatedBy integer NOT NULL DEFAULT 0 , LastUpdated TIMESTAMP NULL , - Disabled int2 NOT NULL DEFAULT 0 , + Disabled integer NOT NULL DEFAULT 0 , PRIMARY KEY (id) ); @@ -108,7 +108,7 @@ CREATE TABLE Principals ( id INTEGER DEFAULT nextval('principals_id_seq') not null, PrincipalType VARCHAR(16) not null, ObjectId integer, - Disabled int2 NOT NULL DEFAULT 0 , + Disabled integer NOT NULL DEFAULT 0 , PRIMARY KEY (id) ); @@ -183,13 +183,16 @@ CREATE SEQUENCE transactions_id_seq; CREATE TABLE Transactions ( id INTEGER DEFAULT nextval('transactions_id_seq'), - EffectiveTicket integer NOT NULL DEFAULT 0 , - Ticket integer NOT NULL DEFAULT 0 , + ObjectType varchar(255) NOT NULL , + ObjectId integer NOT NULL DEFAULT 0 , TimeTaken integer NOT NULL DEFAULT 0 , Type varchar(20) NULL , Field varchar(40) NULL , OldValue varchar(255) NULL , NewValue varchar(255) NULL , + ReferenceType varchar(255) NULL, + OldReference integer NULL , + NewReference integer NULL , Data varchar(255) NULL , Creator integer NOT NULL DEFAULT 0 , @@ -197,8 +200,7 @@ CREATE TABLE Transactions ( PRIMARY KEY (id) ); -CREATE INDEX Transactions1 ON Transactions (Ticket); -CREATE INDEX Transactions2 ON Transactions (EffectiveTicket); +CREATE INDEX Transactions1 ON Transactions (ObjectType, ObjectId); -- }}} @@ -281,6 +283,8 @@ CREATE TABLE GroupMembers ( ); +CREATE UNIQUE INDEX GroupMembers1 ON GroupMembers(GroupId, MemberId); + -- }}} -- {{{ GroupMembersCache @@ -299,7 +303,7 @@ CREATE TABLE CachedGroupMembers ( MemberId int, Via int, ImmediateParentId int, - Disabled int2 NOT NULL DEFAULT 0 , + Disabled integer NOT NULL DEFAULT 0 , PRIMARY KEY (id) ); @@ -362,7 +366,6 @@ CREATE TABLE Users ( CREATE UNIQUE INDEX Users1 ON Users (Name) ; -CREATE INDEX Users2 ON Users (Name); CREATE INDEX Users3 ON Users (id, EmailAddress); CREATE INDEX Users4 ON Users (EmailAddress); @@ -401,12 +404,13 @@ CREATE TABLE Tickets ( Due TIMESTAMP NULL , Resolved TIMESTAMP NULL , + WillResolve TIMESTAMP NULL , LastUpdatedBy integer NOT NULL DEFAULT 0 , LastUpdated TIMESTAMP NULL , Creator integer NOT NULL DEFAULT 0 , Created TIMESTAMP NULL , - Disabled int2 NOT NULL DEFAULT 0 , + Disabled integer NOT NULL DEFAULT 0 , PRIMARY KEY (id) ); @@ -474,7 +478,7 @@ CREATE TABLE Templates ( -- }}} --- {{{ TicketCustomFieldValues +-- {{{ ObjectCustomFieldValues @@ -482,24 +486,31 @@ CREATE TABLE Templates ( -- Sequences for table TICKETCUSTOMFIELDVALUES -- -CREATE SEQUENCE ticketcustomfieldvalues_id_s; +CREATE SEQUENCE objectcustomfieldvalues_id_s; -CREATE TABLE TicketCustomFieldValues ( - id INTEGER DEFAULT nextval('ticketcustomfieldvalues_id_s'), - Ticket int NOT NULL , +CREATE TABLE ObjectCustomFieldValues ( + id INTEGER DEFAULT nextval('objectcustomfieldvalues_id_s'), CustomField int NOT NULL , + ObjectType varchar(255) NULL , + ObjectId int NOT NULL , + SortOrder integer NOT NULL DEFAULT 0 , + Content varchar(255) NULL , + LargeContent text NULL, + ContentType varchar(80) NULL, + ContentEncoding varchar(80) NULL , Creator integer NOT NULL DEFAULT 0 , Created TIMESTAMP NULL , LastUpdatedBy integer NOT NULL DEFAULT 0 , LastUpdated TIMESTAMP NULL , + Disabled integer NOT NULL DEFAULT 0 , PRIMARY KEY (id) ); -CREATE INDEX TicketCustomFieldValues1 ON TicketCustomFieldValues (CustomField,Ticket,Content); -CREATE INDEX TicketCustomFieldValues2 ON TicketCustomFieldValues (CustomField,Ticket); +CREATE INDEX ObjectCustomFieldValues1 ON ObjectCustomFieldValues (CustomField,ObjectType,ObjectId,Content); +CREATE INDEX ObjectCustomFieldValues2 ON ObjectCustomFieldValues (CustomField,ObjectType,ObjectId); -- }}} @@ -517,7 +528,10 @@ CREATE TABLE CustomFields ( id INTEGER DEFAULT nextval('customfields_id_seq'), Name varchar(200) NULL , Type varchar(200) NULL , - Queue integer NOT NULL DEFAULT 0 , + MaxValues integer NOT NULL DEFAULT 0 , + Repeated integer NOT NULL DEFAULT 0 , + Pattern varchar(65536) NULL , + LookupType varchar(255) NOT NULL , Description varchar(255) NULL , SortOrder integer NOT NULL DEFAULT 0 , @@ -525,7 +539,28 @@ CREATE TABLE CustomFields ( Created TIMESTAMP NULL , LastUpdatedBy integer NOT NULL DEFAULT 0 , LastUpdated TIMESTAMP NULL , - Disabled int2 NOT NULL DEFAULT 0 , + Disabled integer NOT NULL DEFAULT 0 , + Required integer NOT NULL DEFAULT 0 , + PRIMARY KEY (id) + +); + +-- }}} + +-- {{{ ObjectCustomFields + +CREATE SEQUENCE objectcustomfields_id_s; + +CREATE TABLE ObjectCustomFields ( + id INTEGER DEFAULT nextval('objectcustomfields_id_s'), + CustomField integer NOT NULL, + ObjectId integer NOT NULL, + SortOrder 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) ); @@ -573,7 +608,7 @@ CREATE TABLE Attributes ( Content text, ContentType varchar(16), ObjectType varchar(64), - ObjectId integer, # foreign key to anything + ObjectId integer, Creator integer NOT NULL DEFAULT 0 , Created TIMESTAMP NULL , LastUpdatedBy integer NOT NULL DEFAULT 0 ,