1 | -- $Id: TestManagerDatabaseForeignKeyErHacks.pgsql 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
2 | --- @file
|
---|
3 | -- VBox Test Manager Database Addendum that adds non-unique foreign keys.
|
---|
4 | --
|
---|
5 | -- This is for getting better visualization in reverse engeering ER tools,
|
---|
6 | -- it is not for production databases.
|
---|
7 | --
|
---|
8 |
|
---|
9 | --
|
---|
10 | -- Copyright (C) 2012-2020 Oracle Corporation
|
---|
11 | --
|
---|
12 | -- This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | -- available from http://www.virtualbox.org. This file is free software;
|
---|
14 | -- you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | -- General Public License (GPL) as published by the Free Software
|
---|
16 | -- Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | -- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | -- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 | --
|
---|
20 | -- The contents of this file may alternatively be used under the terms
|
---|
21 | -- of the Common Development and Distribution License Version 1.0
|
---|
22 | -- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | -- VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | -- CDDL are applicable instead of those of the GPL.
|
---|
25 | --
|
---|
26 | -- You may elect to license modified versions of this file under the
|
---|
27 | -- terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | --
|
---|
29 |
|
---|
30 | \set ON_ERROR_STOP 1
|
---|
31 | \connect testmanager
|
---|
32 |
|
---|
33 | ALTER TABLE TestCaseArgs
|
---|
34 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire) REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
|
---|
35 |
|
---|
36 | ALTER TABLE TestcaseDeps
|
---|
37 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire) REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
|
---|
38 | ALTER TABLE TestcaseDeps
|
---|
39 | ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestCasePreReq,tsExpire) REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
|
---|
40 |
|
---|
41 | ALTER TABLE TestCaseGlobalRsrcDeps
|
---|
42 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire) REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
|
---|
43 | ALTER TABLE TestCaseGlobalRsrcDeps
|
---|
44 | ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idGlobalRsrc, tsExpire) REFERENCES GlobalResources(idGlobalRsrc, tsExpire) MATCH FULL;
|
---|
45 |
|
---|
46 | ALTER TABLE TestGroupMembers
|
---|
47 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestGroup, tsExpire) REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
|
---|
48 | ALTER TABLE TestGroupMembers
|
---|
49 | ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestCase, tsExpire) REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
|
---|
50 |
|
---|
51 | ALTER TABLE SchedGroups
|
---|
52 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idBuildSrc, tsExpire) REFERENCES BuildSources(idBuildSrc, tsExpire) MATCH SIMPLE;
|
---|
53 | ALTER TABLE SchedGroups
|
---|
54 | ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idBuildSrcTestSuite, tsExpire) REFERENCES BuildSources(idBuildSrc, tsExpire) MATCH SIMPLE;
|
---|
55 |
|
---|
56 | ALTER TABLE SchedGroupMembers
|
---|
57 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsExpire) REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
|
---|
58 | ALTER TABLE SchedGroupMembers
|
---|
59 | ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestGroup, tsExpire) REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
|
---|
60 | ALTER TABLE SchedGroupMembers
|
---|
61 | ADD CONSTRAINT non_unique_fk3 FOREIGN KEY (idTestGroupPreReq, tsExpire) REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
|
---|
62 |
|
---|
63 | ALTER TABLE TestBoxes
|
---|
64 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsExpire) REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
|
---|
65 |
|
---|
66 | ALTER TABLE FailureReasons
|
---|
67 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureCategory, tsExpire) REFERENCES FailureCategories(idFailureCategory, tsExpire) MATCH FULL;
|
---|
68 |
|
---|
69 | ALTER TABLE TestResultFailures
|
---|
70 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureReason, tsExpire) REFERENCES FailureReasons(idFailureReason, tsExpire) MATCH FULL;
|
---|
71 |
|
---|
72 | ALTER TABLE BuildBlacklist
|
---|
73 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureReason, tsExpire) REFERENCES FailureReasons(idFailureReason, tsExpire) MATCH FULL;
|
---|
74 |
|
---|
75 | ALTER TABLE GlobalResourceStatuses
|
---|
76 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idGlobalRsrc, tsAllocated) REFERENCES GlobalResources(idGlobalRsrc, tsExpire) MATCH FULL;
|
---|
77 |
|
---|
78 | ALTER TABLE SchedQueues
|
---|
79 | ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsLastScheduled) REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
|
---|
80 |
|
---|