Index: trunk/extensions/ConfirmAccount/archives/patch-account_credentials.sql |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | -- (c) Aaron Schulz, 2007 |
3 | 3 | |
4 | 4 | ALTER TABLE /*$wgDBprefix*/account_requests |
5 | | - ADD acr_type tinyint(255) default 0, |
| 5 | + ADD acr_type tinyint(255) unsigned NOT NULL default 0, |
6 | 6 | DROP INDEX acr_deleted_reg, |
7 | 7 | ADD INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration); |
8 | 8 | |
9 | 9 | -- This stores all of credential information |
10 | 10 | -- When accounts are confirmed, the identity info goes here |
11 | | -CREATE TABLE /*$wgDBprefix*/account_credentials ( |
| 11 | +CREATE TABLE IF NOT EXISTS /*_*/account_credentials ( |
12 | 12 | -- Revision ID # |
13 | | - acd_id int unsigned NOT NULL auto_increment, |
| 13 | + acd_id int unsigned NOT NULL auto_increment PRIMARY KEY, |
14 | 14 | -- Foreign key to user.user_id |
15 | 15 | acd_user_id int unsigned NOT NULL, |
16 | 16 | -- Optional 'real name' to be displayed in credit listings |
— | — | @@ -34,18 +34,16 @@ |
35 | 35 | acd_storage_key VARCHAR(64) NULL, |
36 | 36 | -- Areas of interest |
37 | 37 | acd_areas mediumblob NOT NULL, |
38 | | - |
| 38 | + |
39 | 39 | -- Timestamp of account registration. |
40 | 40 | acd_registration char(14) NOT NULL, |
41 | | - |
| 41 | + |
42 | 42 | -- Timestamp of acceptance |
43 | 43 | acd_accepted binary(14), |
44 | 44 | -- The user who accepted it |
45 | 45 | acd_user int unsigned NOT NULL default 0, |
46 | 46 | -- Reason given in email |
47 | | - acd_comment varchar(255) NOT NULL default '', |
48 | | - |
49 | | - PRIMARY KEY (acd_user_id,acd_id), |
50 | | - UNIQUE KEY (acd_id) |
51 | | - |
| 47 | + acd_comment varchar(255) NOT NULL default '' |
52 | 48 | ) /*$wgDBTableOptions*/; |
| 49 | + |
| 50 | +CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials (acd_user_id,acd_id); |
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.sql |
— | — | @@ -5,8 +5,8 @@ |
6 | 6 | |
7 | 7 | -- This stores all of our reviews, |
8 | 8 | -- the corresponding tags are stored in the tag table |
9 | | -CREATE TABLE /*_*/account_requests ( |
10 | | - acr_id int unsigned NOT NULL auto_increment, |
| 9 | +CREATE TABLE IF NOT EXISTS /*_*/account_requests ( |
| 10 | + acr_id int unsigned NOT NULL auto_increment PRIMARY KEY, |
11 | 11 | -- Usernames must be unique, must not be in the form of |
12 | 12 | -- an IP address. _Shouldn't_ allow slashes or case |
13 | 13 | -- conflicts. Spaces are allowed, and are _not_ converted |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | acr_filename VARCHAR(255) NULL, |
41 | 41 | acr_storage_key VARCHAR(64) NULL, |
42 | 42 | -- Prospective account access level |
43 | | - acr_type tinyint(255) unsigned default 0, |
| 43 | + acr_type tinyint(255) unsigned NOT NULL default 0, |
44 | 44 | -- Areas of interest |
45 | 45 | acr_areas mediumblob NOT NULL, |
46 | 46 | |
— | — | @@ -55,20 +55,19 @@ |
56 | 56 | -- The user who rejected/held it |
57 | 57 | acr_user int unsigned NOT NULL default 0, |
58 | 58 | -- Reason |
59 | | - acr_comment varchar(255) NOT NULL default '', |
60 | | - |
61 | | - PRIMARY KEY (acr_id), |
62 | | - UNIQUE KEY (acr_name), |
63 | | - UNIQUE KEY (acr_email(255)), |
64 | | - INDEX (acr_email_token), |
65 | | - INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration) |
| 59 | + acr_comment varchar(255) NOT NULL default '' |
66 | 60 | ) /*$wgDBTableOptions*/; |
67 | 61 | |
| 62 | +CREATE UNIQUE INDEX /*i*/acr_name ON /*_*/account_requests (acr_name); |
| 63 | +CREATE UNIQUE INDEX /*i*/acr_email ON /*_*/account_requests (acr_email(255)); |
| 64 | +CREATE INDEX /*i*/acr_email_token ON /*_*/account_requests (acr_email_token); |
| 65 | +CREATE INDEX /*i*/acr_type_del_reg ON /*_*/account_requests (acr_type,acr_deleted,acr_registration); |
| 66 | + |
68 | 67 | -- This stores all of credential information |
69 | 68 | -- When accounts are confirmed, the identity info goes here |
70 | | -CREATE TABLE /*_*/account_credentials ( |
| 69 | +CREATE TABLE IF NOT EXISTS /*_*/account_credentials ( |
71 | 70 | -- Revision ID # |
72 | | - acd_id int unsigned NOT NULL auto_increment, |
| 71 | + acd_id int unsigned NOT NULL auto_increment PRIMARY KEY, |
73 | 72 | -- Foreign key to user.user_id |
74 | 73 | acd_user_id int unsigned NOT NULL, |
75 | 74 | -- Optional 'real name' to be displayed in credit listings |
— | — | @@ -102,9 +101,7 @@ |
103 | 102 | -- The user who accepted it |
104 | 103 | acd_user int unsigned NOT NULL default 0, |
105 | 104 | -- Reason given in email |
106 | | - acd_comment varchar(255) NOT NULL default '', |
107 | | - |
108 | | - PRIMARY KEY (acd_user_id,acd_id), |
109 | | - UNIQUE KEY (acd_id) |
110 | | - |
| 105 | + acd_comment varchar(255) NOT NULL default '' |
111 | 106 | ) /*$wgDBTableOptions*/; |
| 107 | + |
| 108 | +CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials (acd_user_id,acd_id); |