Index: trunk/phase3/maintenance/ibm_db2/foreignkeys.sql |
— | — | @@ -1,107 +1,107 @@ |
2 | | -ALTER TABLE user_groups ADD CONSTRAINT USER_GROUPS_FK1 FOREIGN KEY (ug_user) REFERENCES user(user_id) ON DELETE CASCADE
|
3 | | -;
|
4 | | -
|
5 | | -ALTER TABLE user_newtalk ADD CONSTRAINT USER_NEWTALK_FK1 FOREIGN KEY (user_id) REFERENCES user(user_id) ON DELETE CASCADE
|
6 | | -;
|
7 | | -
|
8 | | -ALTER TABLE revision ADD CONSTRAINT REVISION_PAGE_FK FOREIGN KEY (rev_page) REFERENCES page(page_id) ON DELETE CASCADE
|
9 | | -;
|
10 | | -ALTER TABLE revision ADD CONSTRAINT REVISION_USER_FK FOREIGN KEY (rev_user) REFERENCES user(user_id) ON DELETE RESTRICT
|
11 | | -;
|
12 | | -
|
13 | | -ALTER TABLE page_restrictions ADD CONSTRAINT PAGE_RESTRICTIONS_PAGE_FK FOREIGN KEY (pr_page) REFERENCES page(page_id) ON DELETE CASCADE
|
14 | | -;
|
15 | | -
|
16 | | -ALTER TABLE page_props ADD CONSTRAINT PAGE_PROPS_PAGE_FK FOREIGN KEY (pp_page) REFERENCES page(page_id) ON DELETE CASCADE
|
17 | | -;
|
18 | | -
|
19 | | -
|
20 | | -ALTER TABLE redirect ADD CONSTRAINT REDIRECT_FROM_FK FOREIGN KEY (rd_from) REFERENCES page(page_id) ON DELETE CASCADE
|
21 | | -;
|
22 | | -
|
23 | | -ALTER TABLE pagelinks ADD CONSTRAINT PAGELINKS_FROM_FK FOREIGN KEY (pl_from) REFERENCES page(page_id) ON DELETE CASCADE
|
24 | | -;
|
25 | | -
|
26 | | -ALTER TABLE templatelinks ADD CONSTRAINT TEMPLATELINKS_FROM_FK FOREIGN KEY (tl_from) REFERENCES page(page_id) ON DELETE CASCADE
|
27 | | -;
|
28 | | -
|
29 | | -ALTER TABLE imagelinks ADD CONSTRAINT IMAGELINKS_FROM_FK FOREIGN KEY (il_from) REFERENCES page(page_id) ON DELETE CASCADE
|
30 | | -;
|
31 | | -
|
32 | | -ALTER TABLE categorylinks ADD CONSTRAINT CATEGORYLINKS_FROM_FK FOREIGN KEY (cl_from) REFERENCES page(page_id) ON DELETE CASCADE
|
33 | | -;
|
34 | | -
|
35 | | -ALTER TABLE externallinks ADD CONSTRAINT EXTERNALLINKS_FROM_FK FOREIGN KEY (el_from) REFERENCES page(page_id) ON DELETE CASCADE
|
36 | | -;
|
37 | | -
|
38 | | -ALTER TABLE langlinks ADD CONSTRAINT LANGLINKS_FROM_FK FOREIGN KEY (ll_from) REFERENCES page(page_id) ON DELETE CASCADE
|
39 | | -;
|
40 | | -
|
41 | | -
|
42 | | -ALTER TABLE ipblocks ADD CONSTRAINT IPBLOCKS_BY_FK FOREIGN KEY (ipb_by) REFERENCES user(user_id) ON DELETE CASCADE
|
43 | | -;
|
44 | | -
|
45 | | -
|
46 | | -
|
47 | | -ALTER TABLE oldimage ADD CONSTRAINT OLDIMAGE_NAME_FK FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE
|
48 | | -;
|
49 | | -
|
50 | | -
|
51 | | -
|
52 | | -
|
53 | | -
|
54 | | -ALTER TABLE watchlist ADD CONSTRAINT WATCHLIST_USER_FK FOREIGN KEY (wl_user) REFERENCES user(user_id) ON DELETE CASCADE
|
55 | | -;
|
56 | | -
|
57 | | -ALTER TABLE trackbacks ADD CONSTRAINT TRACKBACKS_PAGE_FK FOREIGN KEY (tb_page) REFERENCES page(page_id) ON DELETE CASCADE
|
58 | | -;
|
59 | | -
|
60 | | -
|
| 2 | +-- good |
| 3 | +ALTER TABLE user_groups ADD CONSTRAINT USER_GROUPS_FK1 FOREIGN KEY (ug_user) REFERENCES user(user_id) ON DELETE CASCADE |
| 4 | +; |
| 5 | + |
| 6 | +-- good |
| 7 | +ALTER TABLE user_newtalk ADD CONSTRAINT USER_NEWTALK_FK1 FOREIGN KEY (user_id) REFERENCES user(user_id) ON DELETE CASCADE |
| 8 | +; |
| 9 | + |
| 10 | +-- referenced value not found |
| 11 | +ALTER TABLE revision ADD CONSTRAINT REVISION_PAGE_FK FOREIGN KEY (rev_page) REFERENCES page(page_id) ON DELETE CASCADE |
| 12 | +; |
| 13 | +-- referenced value not found |
| 14 | +ALTER TABLE revision ADD CONSTRAINT REVISION_USER_FK FOREIGN KEY (rev_user) REFERENCES user(user_id) ON DELETE RESTRICT |
| 15 | +; |
| 16 | + |
| 17 | +-- good |
| 18 | +ALTER TABLE page_restrictions ADD CONSTRAINT PAGE_RESTRICTIONS_PAGE_FK FOREIGN KEY (pr_page) REFERENCES page(page_id) ON DELETE CASCADE |
| 19 | +; |
| 20 | + |
| 21 | +-- good |
| 22 | +ALTER TABLE page_props ADD CONSTRAINT PAGE_PROPS_PAGE_FK FOREIGN KEY (pp_page) REFERENCES page(page_id) ON DELETE CASCADE |
| 23 | +; |
| 24 | + |
| 25 | +-- cannot contain null values |
| 26 | +-- ALTER TABLE archive ADD CONSTRAINT ARCHIVE_USER_FK FOREIGN KEY (ar_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 27 | +--; |
| 28 | + |
| 29 | +-- referenced value not found |
| 30 | +ALTER TABLE redirect ADD CONSTRAINT REDIRECT_FROM_FK FOREIGN KEY (rd_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 31 | +; |
| 32 | + |
| 33 | +-- referenced value not found |
| 34 | +ALTER TABLE pagelinks ADD CONSTRAINT PAGELINKS_FROM_FK FOREIGN KEY (pl_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 35 | +; |
| 36 | + |
| 37 | +-- good |
| 38 | +ALTER TABLE templatelinks ADD CONSTRAINT TEMPLATELINKS_FROM_FK FOREIGN KEY (tl_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 39 | +; |
| 40 | + |
| 41 | +-- good |
| 42 | +ALTER TABLE imagelinks ADD CONSTRAINT IMAGELINKS_FROM_FK FOREIGN KEY (il_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 43 | +; |
| 44 | + |
| 45 | +-- good |
| 46 | +ALTER TABLE categorylinks ADD CONSTRAINT CATEGORYLINKS_FROM_FK FOREIGN KEY (cl_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 47 | +; |
| 48 | + |
| 49 | +-- good |
| 50 | +ALTER TABLE externallinks ADD CONSTRAINT EXTERNALLINKS_FROM_FK FOREIGN KEY (el_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 51 | +; |
| 52 | + |
| 53 | +-- good |
| 54 | +ALTER TABLE langlinks ADD CONSTRAINT LANGLINKS_FROM_FK FOREIGN KEY (ll_from) REFERENCES page(page_id) ON DELETE CASCADE |
| 55 | +; |
| 56 | + |
| 57 | +-- cannot contain null values |
| 58 | +-- ALTER TABLE ipblocks ADD CONSTRAINT IPBLOCKS_USER_FK FOREIGN KEY (ipb_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 59 | +--; |
| 60 | + |
| 61 | +-- good |
| 62 | +ALTER TABLE ipblocks ADD CONSTRAINT IPBLOCKS_BY_FK FOREIGN KEY (ipb_by) REFERENCES user(user_id) ON DELETE CASCADE |
| 63 | +; |
| 64 | + |
| 65 | +-- cannot contain null values |
| 66 | +-- ALTER TABLE image ADD CONSTRAINT IMAGE_USER_FK FOREIGN KEY (img_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 67 | +--; |
| 68 | + |
| 69 | +-- cannot contain null values |
| 70 | +-- ALTER TABLE oldimage ADD CONSTRAINT OLDIMAGE_USER_FK FOREIGN KEY (oi_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 71 | +--; |
| 72 | + |
| 73 | +-- good |
| 74 | +ALTER TABLE oldimage ADD CONSTRAINT OLDIMAGE_NAME_FK FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE |
| 75 | +; |
| 76 | + |
| 77 | +-- cannot contain null values |
| 78 | +-- ALTER TABLE filearchive ADD CONSTRAINT FILEARCHIVE_DELETED_USER_FK FOREIGN KEY (fa_deleted_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 79 | +--; |
| 80 | + |
| 81 | +-- cannot contain null values |
| 82 | +-- ALTER TABLE filearchive ADD CONSTRAINT FILEARCHIVE_USER_FK FOREIGN KEY (fa_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 83 | +--; |
| 84 | + |
| 85 | +-- cannot contain null values |
| 86 | +-- ALTER TABLE recentchanges ADD CONSTRAINT RECENTCHANGES_USER_FK FOREIGN KEY (rc_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 87 | +--; |
| 88 | + |
| 89 | +-- cannot contain null values |
| 90 | +-- ALTER TABLE recentchanges ADD CONSTRAINT RECENTCHANGES_CUR_ID_FK FOREIGN KEY (rc_cur_id) REFERENCES page(page_id) ON DELETE SET NULL |
| 91 | +--; |
| 92 | + |
| 93 | +-- good |
| 94 | +ALTER TABLE watchlist ADD CONSTRAINT WATCHLIST_USER_FK FOREIGN KEY (wl_user) REFERENCES user(user_id) ON DELETE CASCADE |
| 95 | +; |
| 96 | + |
| 97 | +-- good |
| 98 | +-- already in MySQL schema |
| 99 | +ALTER TABLE trackbacks ADD CONSTRAINT TRACKBACKS_PAGE_FK FOREIGN KEY (tb_page) REFERENCES page(page_id) ON DELETE CASCADE |
| 100 | +; |
| 101 | + |
| 102 | +-- cannot contain null values |
| 103 | +-- ALTER TABLE protected_titles ADD CONSTRAINT PROTECTED_TITLES_USER_FK FOREIGN KEY (pt_user) REFERENCES user(user_id) ON DELETE SET NULL |
| 104 | +--; |
| 105 | + |
| 106 | +-- cannot contain null values |
| 107 | +-- ALTER TABLE logging ADD CONSTRAINT LOGGING_USER_FK FOREIGN KEY (log_user) REFERENCES user(user_id) ON DELETE SET NULL |
61 | 108 | --; |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/ibm_db2/foreignkeys.sql |
___________________________________________________________________ |
Added: svn:eol-style |
62 | 109 | + native |