MySql_Alter.sql
3.38 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* @filesource MySql_Alter.sql
*
* @category freeSN
* @copyright Copyright by mensch.coop e.G. 2009
* @mailto dev [at] mensch.coop
* @version 0.4.200901
* @link http://mensch.coop
*/
select 'MySql_Alter.sql';
select 'INDEX';
ALTER TABLE losp_BasisElement ADD INDEX ID (ID);
-- ALTER TABLE losp_BasisElement ADD INDEX ID (ID);
select 'FOREIGN KEYs';
select ' - losp_BE_profile';
ALTER TABLE losp_BE_profile
ADD CONSTRAINT BE_profile_MTextID__BasisElement_ID
FOREIGN KEY (MTextID) REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE ON UPDATE CASCADE;
select ' - losp_BE_topic';
ALTER TABLE losp_BE_topic
ADD CONSTRAINT BE_topic_MTextID__BasisElement_ID
FOREIGN KEY (MTextID) REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE;
select ' - losp_BasisElement';
-- ALTER TABLE losp_BasisElement
-- geht nicht, da wenn auch nur ein einzelner Eintrag von der Liste gelöscht wird, beschwert er sich!!
-- ADD CONSTRAINT BE_AuthWriteListID__BE_writeauthorisation_ListID
-- FOREIGN KEY (AuthWriteListID) REFERENCES losp_BasisElement_writeauthorisation(ListID),
-- geht nicht, da wenn auch nur ein einzelner Eintrag von der Liste gelöscht wird, beschwert er sich!!
-- ADD CONSTRAINT BE_AuthReadListID__BE_readauthorisation_ListID
-- FOREIGN KEY (AuthReadListID) REFERENCES losp_BasisElement_readauthorisation(ListID)
-- ;
select ' - losp_BasisElementDesign';
ALTER TABLE losp_BasisElementDesign
ADD CONSTRAINT BED_Author_ProfileID___BE_profile_MTextID
FOREIGN KEY (Author_ProfileID) REFERENCES losp_BE_profile(MTextID)
ON DELETE SET NULL ON UPDATE CASCADE;
select ' - losp_BasisElementDesign_values';
ALTER TABLE losp_BasisElementDesign_values
ADD CONSTRAINT BED_values_ID__BED_ID
FOREIGN KEY (ID) REFERENCES losp_BasisElementDesign(ID)
ON DELETE CASCADE ON UPDATE CASCADE;
select ' - losp_BasisElement_categorynamelist';
ALTER TABLE losp_BasisElement_categorynamelist
ADD CONSTRAINT BEC_namelist_BECategoryGroupID__BEC_namelist_BECategoryID
FOREIGN KEY (BECategoryGroupID) REFERENCES losp_BasisElement_categorynamelist(BECategoryID)
ON DELETE CASCADE ON UPDATE CASCADE;
select ' - losp_be_account';
ALTER TABLE losp_be_account
ADD CONSTRAINT be_account__BE_profile_MTextID
FOREIGN KEY (ProfileID) REFERENCES losp_BE_profile(MTextID)
ON DELETE SET NULL ON UPDATE CASCADE;
select ' - losp_BasisClipboard';
ALTER TABLE losp_BasisClipboard
ADD CONSTRAINT BC_PartOfID__BasisElement_ID
FOREIGN KEY (PartOfID) REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT BC_AttachID___BasisElement_ID
FOREIGN KEY (AttachID) REFERENCES losp_BasisElement(ID)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT BC_AttachStateID__BasisClipboard_state_StateID
FOREIGN KEY (AttachStateID) REFERENCES losp_BasisClipboard_state(StateID)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT BC_CategoryID__BasisClipboard_category_CategoryID
FOREIGN KEY (CategoryID) REFERENCES losp_BasisClipboard_category(CategoryID)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT BC_PartOfObjVarID__BasisClipboard_objvar_PartOfObjVarID
FOREIGN KEY (PartOfObjVarID) REFERENCES losp_BasisClipboard_objvar(PartOfObjVarID)
ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT BC_LinkerProfileID__losp_BE_profile_MTextID
FOREIGN KEY (LinkerProfileID) REFERENCES losp_BE_profile(MTextID)
ON DELETE CASCADE ON UPDATE CASCADE
;