blob: 33a037673e81f4c924354b51c4689c6f3dbad433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#ALTER TABLE Users ADD FOREIGN KEY (Creator) REFERENCES Users(id);
#ALTER TABLE Users ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE Links ADD FOREIGN KEY (LocalBase) REFERENCES Tickets(id) ;
ALTER TABLE Links ADD FOREIGN KEY (LocalTarget) REFERENCES Tickets(id);
ObjectId integer, # FOREIGN KEY to Users or Groups, depending
ALTER TABLE Tickets ADD FOREIGN KEY (Queue) REFERENCES Queues(id);
ALTER TABLE Tickets ADD FOREIGN KEY (EffectiveId) REFERENCES Tickets(id);
ALTER TABLE Tickets ADD FOREIGN KEY (Owner) REFERENCES Principals(id);
ALTER TABLE Tickets ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE Tickets ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE Transactions ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE Transactions ADD FOREIGN KEY (Ticket) REFERENCES Tickets(id);
ALTER TABLE Transactions ADD FOREIGN KEY (EffectiveTicket) REFERENCES Tickets(id);
ALTER TABLE Attachments ADD FOREIGN KEY (TransactionId) REFERENCES Transactions(id);
ALTER TABLE Attachments ADD FOREIGN KEY (Parent) REFERENCES Attachments(id);
ALTER TABLE Scrips ADD FOREIGN KEY (ScripCondition) REFERENCES ScripConditions(id);
ALTER TABLE Scrips ADD FOREIGN KEY (ScripAction) REFERENCES ScripActions(id);
ALTER TABLE Scrips ADD FOREIGN KEY (Template) REFERENCES Templates(id);
ALTER TABLE Scrips ADD FOREIGN KEY (Queue) REFERENCES Queues(id);
ALTER TABLE Scrips ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE Scrips ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
PrincipalId integer NOT NULL , #ALTER TABLE ADD FOREIGN KEY to principals
DelegatedBy integer NOT NULL default 0, #ALTER TABLE ADD FOREIGN KEY to principals with a userid
DelegatedFrom integer NOT NULL default 0, #ALTER TABLE ADD FOREIGN KEY to ACL
ALTER TABLE ACL ADD FOREIGN KEY (PrincipalId) REFERENCES Principals(id);
ALTER TABLE ACL ADD FOREIGN KEY (DelegatedBy) REFERENCES Principals(id);
ALTER TABLE ACL ADD FOREIGN KEY (DelegatedFrom) REFERENCES ACL(id);
ALTER TABLE GroupMembers ADD FOREIGN KEY (GroupId) REFERENCES Principals(id);
ALTER TABLE GroupMembers ADD FOREIGN KEY (MemberId) REFERENCES Principals(id);
GroupId int, # ALTER TABLE ADD FOREIGN KEY to Principals
MemberId int, # ALTER TABLE ADD FOREIGN KEY to Principals
Via int, #ALTER TABLE ADD FOREIGN KEY to CachedGroupMembers. (may point to $self->id)
ImmediateParentId int, #ALTER TABLE ADD FOREIGN KEY to prinicpals.
ALTER TABLE CachedGroupMembers ADD FOREIGN KEY (ImmediateParentId) REFERENCES Principals(id);
ALTER TABLE CachedGroupMembers ADD FOREIGN KEY (GroupId) REFERENCES Principals(id);
ALTER TABLE CachedGroupMembers ADD FOREIGN KEY (MemberId) REFERENCES Principals(id);
ALTER TABLE CachedGroupMembers ADD FOREIGN KEY (Via) REFERENCES CachedGroupMembers(id);
ALTER TABLE ScripActions ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE ScripActions ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE Templates ADD FOREIGN KEY (Queue) REFERENCES Queues(id);
ALTER TABLE Templates ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE Templates ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE CustomFields ADD FOREIGN KEY (Queue) REFERENCES Queues(id);
ALTER TABLE CustomFields ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE CustomFields ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE TicketCustomFieldValues ADD FOREIGN KEY (Ticket) REFERENCES Ticketss(id);
ALTER TABLE TicketCustomFieldValues ADD FOREIGN KEY (CustomField) REFERENCES CustomFields(id);
ALTER TABLE TicketCustomFieldValues ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE TicketCustomFieldValues ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
ALTER TABLE CustomFieldValues ADD FOREIGN KEY (CustomField) REFERENCES CustomFields(id);
ALTER TABLE CustomFieldValues ADD FOREIGN KEY (Creator) REFERENCES Users(id);
ALTER TABLE CustomFieldValues ADD FOREIGN KEY (LastUpdatedBy) REFERENCES Users(id);
|