Index: branches/robchurch/newtalk/maintenance/postgres/archives/patch-fix-newtalk.sql |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +-- Alters columns in `user_newtalk` to be nullable and |
| 3 | +-- drops existing indices in favour of a single UNIQUE |
| 4 | +-- index |
| 5 | +ALTER TABLE user_newtalk DROP INDEX user_newtalk_id_idx, |
| 6 | +DROP INDEX user_newtalk_ip_idx, ALTER user_id DROP NOT NULL, |
| 7 | +ALTER user_ip DROP NOT NULL; |
| 8 | + |
| 9 | +CREATE UNIQUE INDEX user_newtalk_unique ON user_newtalk ( user_id, user_ip ); |
\ No newline at end of file |
Property changes on: branches/robchurch/newtalk/maintenance/postgres/archives/patch-fix-newtalk.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: branches/robchurch/newtalk/maintenance/postgres/tables.sql |
— | — | @@ -41,13 +41,11 @@ |
42 | 42 | CREATE UNIQUE INDEX user_groups_unique ON user_groups (ug_user, ug_group); |
43 | 43 | |
44 | 44 | CREATE TABLE user_newtalk ( |
45 | | - user_id INTEGER NOT NULL REFERENCES mwuser(user_id) ON DELETE CASCADE, |
| 45 | + user_id INTEGER NULL REFERENCES mwuser(user_id) ON DELETE CASCADE, |
46 | 46 | user_ip TEXT NULL |
47 | 47 | ); |
48 | | -CREATE INDEX user_newtalk_id_idx ON user_newtalk (user_id); |
49 | | -CREATE INDEX user_newtalk_ip_idx ON user_newtalk (user_ip); |
| 48 | +CREATE UNIQUE INDEX user_newtalk_unique ON user_newtalk(user_id, user_ip); |
50 | 49 | |
51 | | - |
52 | 50 | CREATE SEQUENCE page_page_id_seq; |
53 | 51 | CREATE TABLE page ( |
54 | 52 | page_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('page_page_id_seq'), |