r97984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97983‎ | r97984 | r97985 >
Date:06:55, 24 September 2011
Author:aaron
Status:deferred
Tags:
Comment:
Refactoring schema change hooks and file locations
Modified paths:
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql (deleted) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.php (modified) (history)
  • /trunk/extensions/ConfirmAccount/ConfirmAccount.sql (deleted) (history)
  • /trunk/extensions/ConfirmAccount/archives (deleted) (history)
  • /trunk/extensions/ConfirmAccount/postgres (deleted) (history)
  • /trunk/extensions/ConfirmAccount/schema (added) (history)
  • /trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php (added) (history)
  • /trunk/extensions/ConfirmAccount/schema/mysql (added) (history)
  • /trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql (added) (history)
  • /trunk/extensions/ConfirmAccount/schema/postgres (added) (history)
  • /trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql (added) (history)

Diff [purge]

Index: trunk/extensions/ConfirmAccount/ConfirmAccount.sql
@@ -1,107 +0,0 @@
2 -
3 -
4 -CREATE TABLE IF NOT EXISTS /*_*/account_requests (
5 - acr_id int unsigned NOT NULL auto_increment PRIMARY KEY,
6 - -- Usernames must be unique, must not be in the form of
7 - -- an IP address. _Shouldn't_ allow slashes or case
8 - -- conflicts. Spaces are allowed, and are _not_ converted
9 - -- to underscores like titles. See the User::newFromName() for
10 - -- the specific tests that usernames have to pass.
11 - acr_name varchar(255) binary NOT NULL default '',
12 - -- Optional 'real name' to be displayed in credit listings
13 - acr_real_name varchar(255) binary NOT NULL default '',
14 - -- Note: email should be restricted, not public info.
15 - -- Same with passwords.
16 - acr_email tinytext NOT NULL,
17 - -- Initially NULL; when a user's e-mail address has been
18 - -- validated by returning with a mailed token, this is
19 - -- set to the current timestamp.
20 - acr_email_authenticated binary(14) default NULL,
21 - -- Randomly generated token created when the e-mail address
22 - -- is set and a confirmation test mail sent.
23 - acr_email_token binary(32),
24 - -- Expiration date for the user_email_token
25 - acr_email_token_expires binary(14),
26 - -- A little about this user
27 - acr_bio mediumblob NOT NULL,
28 - -- Private info for reviewers to look at when considering request
29 - acr_notes mediumblob NOT NULL,
30 - -- Links to recognize/identify this user, CSV, may not be public
31 - acr_urls mediumblob NOT NULL,
32 - -- IP address
33 - acr_ip VARCHAR(255) NULL default '',
34 - -- Name of attached file (.pdf,.doc,.txt etc...)
35 - acr_filename VARCHAR(255) NULL,
36 - acr_storage_key VARCHAR(64) NULL,
37 - -- Prospective account access level
38 - acr_type tinyint(255) unsigned NOT NULL default 0,
39 - -- Areas of interest
40 - acr_areas mediumblob NOT NULL,
41 -
42 - -- Timestamp of account registration.
43 - acr_registration char(14) NOT NULL,
44 -
45 - -- Flag for rejected accounts
46 - acr_deleted bool NOT NULL,
47 - -- Time of rejection (if rejected)
48 - acr_rejected binary(14),
49 - -- Time request was put on hold (if held)
50 - acr_held binary(14),
51 - -- The user who rejected/held it
52 - acr_user int unsigned NOT NULL default 0,
53 - -- Reason
54 - acr_comment varchar(255) NOT NULL default ''
55 -) /*$wgDBTableOptions*/;
56 -
57 -CREATE UNIQUE INDEX /*i*/acr_name ON /*_*/account_requests (acr_name);
58 -CREATE UNIQUE INDEX /*i*/acr_email ON /*_*/account_requests (acr_email(255));
59 -CREATE INDEX /*i*/acr_email_token ON /*_*/account_requests (acr_email_token);
60 -CREATE INDEX /*i*/acr_type_del_reg ON /*_*/account_requests (acr_type,acr_deleted,acr_registration);
61 -
62 -CREATE TABLE IF NOT EXISTS /*_*/account_credentials (
63 - -- Revision ID #
64 - acd_id int unsigned NOT NULL auto_increment PRIMARY KEY,
65 - -- Foreign key to user.user_id
66 - acd_user_id int unsigned NOT NULL,
67 - -- Optional 'real name' to be displayed in credit listings
68 - acd_real_name varchar(255) binary NOT NULL default '',
69 - -- Note: email should be restricted, not public info.
70 - -- Same with passwords.
71 - acd_email tinytext NOT NULL,
72 - -- Initially NULL; when a user's e-mail address has been
73 - -- validated by returning with a mailed token, this is
74 - -- set to the current timestamp.
75 - acd_email_authenticated binary(14) default NULL,
76 - -- A little about this user
77 - acd_bio mediumblob NOT NULL,
78 - -- Private info for reviewers to look at when considering request
79 - acd_notes mediumblob NOT NULL,
80 - -- Links to recognize/identify this user, CSV, may not be public
81 - acd_urls mediumblob NOT NULL,
82 - -- IP address
83 - acd_ip VARCHAR(255) NULL default '',
84 - -- Name of attached file (.pdf,.doc,.txt etc...)
85 - acd_filename VARCHAR(255) NULL,
86 - acd_storage_key VARCHAR(64) NULL,
87 - -- Areas of interest
88 - acd_areas mediumblob NOT NULL,
89 -
90 - -- Timestamp of account registration.
91 - acd_registration char(14) NOT NULL,
92 -
93 - -- Timestamp of acceptance
94 - acd_accepted binary(14),
95 - -- The user who accepted it
96 - acd_user int unsigned NOT NULL default 0,
97 - -- Reason given in email
98 - acd_comment varchar(255) NOT NULL default ''
99 -) /*$wgDBTableOptions*/;
100 -
101 -CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials (acd_user_id,acd_id);
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql
@@ -1,58 +0,0 @@
2 -
3 -
4 -BEGIN;
5 -
6 -CREATE SEQUENCE account_requests_acr_id_seq;
7 -CREATE TABLE account_requests (
8 - acr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('account_requests_acr_id_seq'),
9 - acr_name TEXT NOT NULL UNIQUE,
10 - acr_real_name TEXT,
11 - acr_email TEXT,
12 - acr_email_token CHAR(32),
13 - acr_email_token_expires TIMESTAMPTZ,
14 - acr_email_authenticated TIMESTAMPTZ,
15 - acr_registration TIMESTAMPTZ,
16 - acr_bio TEXT,
17 - acr_notes TEXT,
18 - acr_urls TEXT,
19 - acr_ip CIDR,
20 - acr_filename TEXT,
21 - acr_storage_key TEXT,
22 - acr_type INTEGER NOT NULL DEFAULT 0,
23 - acr_areas TEXT,
24 - acr_deleted BOOL NOT NULL DEFAULT 'false',
25 - acr_rejected TIMESTAMPTZ,
26 - acr_held TIMESTAMPTZ,
27 - acr_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
28 - acr_comment TEXT NOT NULL DEFAULT ''
29 -);
30 -
31 -CREATE INDEX acr_type_del_reg ON account_requests (acr_type,acr_deleted,acr_registration);
32 -CREATE INDEX acr_email_token ON account_requests (acr_email_token);
33 -CREATE UNIQUE INDEX acr_email ON account_requests (acr_email);
34 -
35 -CREATE SEQUENCE account_credentials_acd_id_seq;
36 -CREATE TABLE account_credentials (
37 - acd_id INTEGER NOT NULL DEFAULT nextval('account_credentials_acd_id_seq'),
38 - acd_user_id INTEGER,
39 - acd_real_name TEXT,
40 - acd_email TEXT,
41 - acd_email_authenticated TIMESTAMPTZ,
42 - acd_registration TIMESTAMPTZ,
43 - acd_bio TEXT,
44 - acd_notes TEXT,
45 - acd_urls TEXT,
46 - acd_ip CIDR,
47 - acd_filename TEXT,
48 - acd_storage_key TEXT,
49 - acd_areas TEXT,
50 - acd_accepted TIMESTAMPTZ,
51 - acd_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
52 - acd_comment TEXT NOT NULL DEFAULT '',
53 - PRIMARY KEY (acd_id, acd_user_id)
54 -);
55 -CREATE UNIQUE INDEX acd_id_index ON account_credentials (acd_id);
56 -
57 -COMMIT;
Index: trunk/extensions/ConfirmAccount/ConfirmAccount.php
@@ -164,6 +164,8 @@
165165 $wgSpecialPages['UserCredentials'] = 'UserCredentialsPage';
166166 $wgAutoloadClasses['UserCredentialsPage'] = $dir . 'UserCredentials_body.php';
167167 $wgSpecialPageGroups['UserCredentials'] = 'users';
 168+# Schema changes
 169+$wgAutoloadClasses['ConfirmAccountUpdaterHooks'] = $dir . 'schema/ConfirmAccountUpdater.hooks.php';
168170
169171 # Make sure "login / create account" notice still as "create account"
170172 $wgHooks['PersonalUrls'][] = 'ConfirmAccountUIHooks::setRequestLoginLinks';
@@ -177,66 +179,4 @@
178180 # Register admin pages for AdminLinks extension.
179181 $wgHooks['AdminLinks'][] = 'ConfirmAccountUIHooks::confirmAccountAdminLinks';
180182
181 -$wgHooks['LoadExtensionSchemaUpdates'][] = 'efConfirmAccountSchemaUpdates';
182 -
183 -function efConfirmAccountSchemaUpdates( $updater = null ) {
184 - $base = dirname( __FILE__ );
185 - if ( $updater === null ) {
186 - global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, $wgExtNewTables, $wgExtNewIndexes;
187 -
188 - if ( $wgDBtype == 'mysql' ) {
189 - $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.sql" );
190 -
191 - $wgExtNewFields[] = array( 'account_requests', 'acr_filename',
192 - "$base/archives/patch-acr_filename.sql" );
193 -
194 - $wgExtNewTables[] = array( 'account_credentials', "$base/archives/patch-account_credentials.sql" );
195 -
196 - $wgExtNewFields[] = array( 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql" );
197 -
198 - $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql" );
199 - } elseif ( $wgDBtype == 'postgres' ) {
200 - $wgExtNewTables[] = array( 'account_requests', "$base/ConfirmAccount.pg.sql" );
201 -
202 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_held', "TIMESTAMPTZ" );
203 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_filename', "TEXT" );
204 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_storage_key', "TEXT" );
205 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" );
206 -
207 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" );
208 - $wgExtNewTables[] = array( 'account_credentials', "$base/postgres/patch-account_credentials.sql" );
209 - $wgExtPGNewFields[] = array( 'account_requests', 'acr_areas', "TEXT" );
210 - $wgExtPGNewFields[] = array( 'account_credentials', 'acd_areas', "TEXT" );
211 -
212 - $wgExtNewIndexes[] = array( 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql" );
213 - }
214 - } else {
215 - if ( $updater->getDB()->getType() == 'mysql' ) {
216 - $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.sql", true ) );
217 -
218 - $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_filename',
219 - "$base/archives/patch-acr_filename.sql", true ) );
220 -
221 - $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/archives/patch-account_credentials.sql", true ) );
222 -
223 - $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) );
224 -
225 - $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) );
226 - } elseif ( $updater->getDB()->getType() == 'postgres' ) {
227 - $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.pg.sql", true ) );
228 -
229 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
230 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_filename', "TEXT" ) );
231 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_storage_key', "TEXT" ) );
232 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) );
233 -
234 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) );
235 - $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) );
236 - $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_areas', "TEXT" ) );
237 - $updater->addExtensionUpdate( array( 'addPgField', 'account_credentials', 'acd_areas', "TEXT" ) );
238 -
239 - $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true ) );
240 - }
241 - }
242 - return true;
243 -}
 183+$wgHooks['LoadExtensionSchemaUpdates'][] = 'ConfirmAccountUpdaterHooks::addSchemaUpdates';
Index: trunk/extensions/ConfirmAccount/schema/mysql/patch-acr_filename.sql
@@ -0,0 +1,7 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+ALTER TABLE /*$wgDBprefix*/account_requests
 5+ ADD acr_filename VARCHAR(255) NULL,
 6+ ADD acr_storage_key VARCHAR(64) NULL,
 7+ ADD acr_held binary(14),
 8+ ADD acr_comment VARCHAR(255) NULL;
Property changes on: trunk/extensions/ConfirmAccount/schema/mysql/patch-acr_filename.sql
___________________________________________________________________
Added: svn:eol-style
19 + native
Index: trunk/extensions/ConfirmAccount/schema/mysql/patch-account_credentials.sql
@@ -0,0 +1,49 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+ALTER TABLE /*$wgDBprefix*/account_requests
 5+ ADD acr_type tinyint(255) unsigned NOT NULL default 0,
 6+ DROP INDEX acr_deleted_reg,
 7+ ADD INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration);
 8+
 9+-- This stores all of credential information
 10+-- When accounts are confirmed, the identity info goes here
 11+CREATE TABLE IF NOT EXISTS /*_*/account_credentials (
 12+ -- Revision ID #
 13+ acd_id int unsigned NOT NULL auto_increment PRIMARY KEY,
 14+ -- Foreign key to user.user_id
 15+ acd_user_id int unsigned NOT NULL,
 16+ -- Optional 'real name' to be displayed in credit listings
 17+ acd_real_name varchar(255) binary NOT NULL default '',
 18+ -- Note: email should be restricted, not public info.
 19+ -- Same with passwords.
 20+ acd_email tinytext NOT NULL,
 21+ -- Initially NULL; when a user's e-mail address has been
 22+ -- validated by returning with a mailed token, this is
 23+ -- set to the current timestamp.
 24+ acd_email_authenticated binary(14) default NULL,
 25+ -- A little about this user
 26+ acd_bio mediumblob NOT NULL,
 27+ -- Private info for reviewers to look at when considering request
 28+ acd_notes mediumblob NOT NULL,
 29+ -- Links to recognize/identify this user, CSV, may not be public
 30+ acd_urls mediumblob NOT NULL,
 31+ -- IP address
 32+ acd_ip VARCHAR(255) NULL default '',
 33+ -- Name of attached file (.pdf,.doc,.txt etc...)
 34+ acd_filename VARCHAR(255) NULL,
 35+ acd_storage_key VARCHAR(64) NULL,
 36+ -- Areas of interest
 37+ acd_areas mediumblob NOT NULL,
 38+
 39+ -- Timestamp of account registration.
 40+ acd_registration char(14) NOT NULL,
 41+
 42+ -- Timestamp of acceptance
 43+ acd_accepted binary(14),
 44+ -- The user who accepted it
 45+ acd_user int unsigned NOT NULL default 0,
 46+ -- Reason given in email
 47+ acd_comment varchar(255) NOT NULL default ''
 48+) /*$wgDBTableOptions*/;
 49+
 50+CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials (acd_user_id,acd_id);
Property changes on: trunk/extensions/ConfirmAccount/schema/mysql/patch-account_credentials.sql
___________________________________________________________________
Added: svn:eol-style
151 + native
Index: trunk/extensions/ConfirmAccount/schema/mysql/patch-email-index.sql
@@ -0,0 +1,4 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+ALTER TABLE /*$wgDBprefix*/account_requests
 5+ ADD UNIQUE INDEX acr_email(acr_email(255));
Property changes on: trunk/extensions/ConfirmAccount/schema/mysql/patch-email-index.sql
___________________________________________________________________
Added: svn:eol-style
16 + native
Index: trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql
@@ -0,0 +1,107 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+-- Table structure for table `Confirm account`
 5+-- Replace /*$wgDBprefix*/ with the proper prefix
 6+
 7+-- This stores all of our reviews,
 8+-- the corresponding tags are stored in the tag table
 9+CREATE TABLE IF NOT EXISTS /*_*/account_requests (
 10+ acr_id int unsigned NOT NULL auto_increment PRIMARY KEY,
 11+ -- Usernames must be unique, must not be in the form of
 12+ -- an IP address. _Shouldn't_ allow slashes or case
 13+ -- conflicts. Spaces are allowed, and are _not_ converted
 14+ -- to underscores like titles. See the User::newFromName() for
 15+ -- the specific tests that usernames have to pass.
 16+ acr_name varchar(255) binary NOT NULL default '',
 17+ -- Optional 'real name' to be displayed in credit listings
 18+ acr_real_name varchar(255) binary NOT NULL default '',
 19+ -- Note: email should be restricted, not public info.
 20+ -- Same with passwords.
 21+ acr_email tinytext NOT NULL,
 22+ -- Initially NULL; when a user's e-mail address has been
 23+ -- validated by returning with a mailed token, this is
 24+ -- set to the current timestamp.
 25+ acr_email_authenticated binary(14) default NULL,
 26+ -- Randomly generated token created when the e-mail address
 27+ -- is set and a confirmation test mail sent.
 28+ acr_email_token binary(32),
 29+ -- Expiration date for the user_email_token
 30+ acr_email_token_expires binary(14),
 31+ -- A little about this user
 32+ acr_bio mediumblob NOT NULL,
 33+ -- Private info for reviewers to look at when considering request
 34+ acr_notes mediumblob NOT NULL,
 35+ -- Links to recognize/identify this user, CSV, may not be public
 36+ acr_urls mediumblob NOT NULL,
 37+ -- IP address
 38+ acr_ip VARCHAR(255) NULL default '',
 39+ -- Name of attached file (.pdf,.doc,.txt etc...)
 40+ acr_filename VARCHAR(255) NULL,
 41+ acr_storage_key VARCHAR(64) NULL,
 42+ -- Prospective account access level
 43+ acr_type tinyint(255) unsigned NOT NULL default 0,
 44+ -- Areas of interest
 45+ acr_areas mediumblob NOT NULL,
 46+
 47+ -- Timestamp of account registration.
 48+ acr_registration char(14) NOT NULL,
 49+
 50+ -- Flag for rejected accounts
 51+ acr_deleted bool NOT NULL,
 52+ -- Time of rejection (if rejected)
 53+ acr_rejected binary(14),
 54+ -- Time request was put on hold (if held)
 55+ acr_held binary(14),
 56+ -- The user who rejected/held it
 57+ acr_user int unsigned NOT NULL default 0,
 58+ -- Reason
 59+ acr_comment varchar(255) NOT NULL default ''
 60+) /*$wgDBTableOptions*/;
 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+
 67+-- This stores all of credential information
 68+-- When accounts are confirmed, the identity info goes here
 69+CREATE TABLE IF NOT EXISTS /*_*/account_credentials (
 70+ -- Revision ID #
 71+ acd_id int unsigned NOT NULL auto_increment PRIMARY KEY,
 72+ -- Foreign key to user.user_id
 73+ acd_user_id int unsigned NOT NULL,
 74+ -- Optional 'real name' to be displayed in credit listings
 75+ acd_real_name varchar(255) binary NOT NULL default '',
 76+ -- Note: email should be restricted, not public info.
 77+ -- Same with passwords.
 78+ acd_email tinytext NOT NULL,
 79+ -- Initially NULL; when a user's e-mail address has been
 80+ -- validated by returning with a mailed token, this is
 81+ -- set to the current timestamp.
 82+ acd_email_authenticated binary(14) default NULL,
 83+ -- A little about this user
 84+ acd_bio mediumblob NOT NULL,
 85+ -- Private info for reviewers to look at when considering request
 86+ acd_notes mediumblob NOT NULL,
 87+ -- Links to recognize/identify this user, CSV, may not be public
 88+ acd_urls mediumblob NOT NULL,
 89+ -- IP address
 90+ acd_ip VARCHAR(255) NULL default '',
 91+ -- Name of attached file (.pdf,.doc,.txt etc...)
 92+ acd_filename VARCHAR(255) NULL,
 93+ acd_storage_key VARCHAR(64) NULL,
 94+ -- Areas of interest
 95+ acd_areas mediumblob NOT NULL,
 96+
 97+ -- Timestamp of account registration.
 98+ acd_registration char(14) NOT NULL,
 99+
 100+ -- Timestamp of acceptance
 101+ acd_accepted binary(14),
 102+ -- The user who accepted it
 103+ acd_user int unsigned NOT NULL default 0,
 104+ -- Reason given in email
 105+ acd_comment varchar(255) NOT NULL default ''
 106+) /*$wgDBTableOptions*/;
 107+
 108+CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials (acd_user_id,acd_id);
Property changes on: trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql
___________________________________________________________________
Added: svn:eol-style
1109 + native
Index: trunk/extensions/ConfirmAccount/schema/mysql/patch-acr_areas.sql
@@ -0,0 +1,7 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+ALTER TABLE /*$wgDBprefix*/account_requests
 5+ ADD acr_areas mediumblob NOT NULL;
 6+
 7+ALTER TABLE /*$wgDBprefix*/account_credentials
 8+ ADD acd_areas mediumblob NOT NULL;
Property changes on: trunk/extensions/ConfirmAccount/schema/mysql/patch-acr_areas.sql
___________________________________________________________________
Added: svn:eol-style
19 + native
Index: trunk/extensions/ConfirmAccount/schema/postgres/patch-account_credentials.sql
@@ -0,0 +1,28 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+BEGIN;
 5+
 6+CREATE SEQUENCE account_credentials_acd_id_seq;
 7+CREATE TABLE account_credentials (
 8+ acd_id INTEGER NOT NULL DEFAULT nextval('account_credentials_acd_id_seq'),
 9+ acd_user_id INTEGER,
 10+ acd_real_name TEXT,
 11+ acd_email TEXT,
 12+ acd_email_authenticated TIMESTAMPTZ,
 13+ acd_registration TIMESTAMPTZ,
 14+ acd_bio TEXT,
 15+ acd_notes TEXT,
 16+ acd_urls TEXT,
 17+ acd_ip CIDR,
 18+ acd_filename TEXT,
 19+ acd_storage_key TEXT,
 20+ acd_areas TEXT,
 21+ acd_accepted TIMESTAMPTZ,
 22+ acd_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
 23+ acd_comment TEXT NOT NULL DEFAULT '',
 24+ PRIMARY KEY (acd_id, acd_user_id)
 25+);
 26+CREATE UNIQUE INDEX acd_id_index ON account_credentials (acd_id);
 27+
 28+
 29+COMMIT;
Property changes on: trunk/extensions/ConfirmAccount/schema/postgres/patch-account_credentials.sql
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: trunk/extensions/ConfirmAccount/schema/postgres/patch-email-index.sql
@@ -0,0 +1,5 @@
 2+BEGIN;
 3+
 4+CREATE UNIQUE INDEX acr_email ON account_requests (acr_email);
 5+
 6+COMMIT;
Property changes on: trunk/extensions/ConfirmAccount/schema/postgres/patch-email-index.sql
___________________________________________________________________
Added: svn:eol-style
17 + native
Index: trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql
@@ -0,0 +1,58 @@
 2+-- (c) Aaron Schulz, 2007
 3+
 4+-- Postgres schema for Confirm Account extension
 5+
 6+BEGIN;
 7+
 8+CREATE SEQUENCE account_requests_acr_id_seq;
 9+CREATE TABLE account_requests (
 10+ acr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('account_requests_acr_id_seq'),
 11+ acr_name TEXT NOT NULL UNIQUE,
 12+ acr_real_name TEXT,
 13+ acr_email TEXT,
 14+ acr_email_token CHAR(32),
 15+ acr_email_token_expires TIMESTAMPTZ,
 16+ acr_email_authenticated TIMESTAMPTZ,
 17+ acr_registration TIMESTAMPTZ,
 18+ acr_bio TEXT,
 19+ acr_notes TEXT,
 20+ acr_urls TEXT,
 21+ acr_ip CIDR,
 22+ acr_filename TEXT,
 23+ acr_storage_key TEXT,
 24+ acr_type INTEGER NOT NULL DEFAULT 0,
 25+ acr_areas TEXT,
 26+ acr_deleted BOOL NOT NULL DEFAULT 'false',
 27+ acr_rejected TIMESTAMPTZ,
 28+ acr_held TIMESTAMPTZ,
 29+ acr_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
 30+ acr_comment TEXT NOT NULL DEFAULT ''
 31+);
 32+
 33+CREATE INDEX acr_type_del_reg ON account_requests (acr_type,acr_deleted,acr_registration);
 34+CREATE INDEX acr_email_token ON account_requests (acr_email_token);
 35+CREATE UNIQUE INDEX acr_email ON account_requests (acr_email);
 36+
 37+CREATE SEQUENCE account_credentials_acd_id_seq;
 38+CREATE TABLE account_credentials (
 39+ acd_id INTEGER NOT NULL DEFAULT nextval('account_credentials_acd_id_seq'),
 40+ acd_user_id INTEGER,
 41+ acd_real_name TEXT,
 42+ acd_email TEXT,
 43+ acd_email_authenticated TIMESTAMPTZ,
 44+ acd_registration TIMESTAMPTZ,
 45+ acd_bio TEXT,
 46+ acd_notes TEXT,
 47+ acd_urls TEXT,
 48+ acd_ip CIDR,
 49+ acd_filename TEXT,
 50+ acd_storage_key TEXT,
 51+ acd_areas TEXT,
 52+ acd_accepted TIMESTAMPTZ,
 53+ acd_user INTEGER REFERENCES mwuser(user_id) ON DELETE SET NULL,
 54+ acd_comment TEXT NOT NULL DEFAULT '',
 55+ PRIMARY KEY (acd_id, acd_user_id)
 56+);
 57+CREATE UNIQUE INDEX acd_id_index ON account_credentials (acd_id);
 58+
 59+COMMIT;
Property changes on: trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql
___________________________________________________________________
Added: svn:eol-style
160 + native
Index: trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php
@@ -0,0 +1,33 @@
 2+<?php
 3+/**
 4+ * Class containing updater functions for a ConfirmAccount environment
 5+ */
 6+class ConfirmAccountUpdaterHooks {
 7+ public static function addSchemaUpdates( DatabaseUpdater $updater ) {
 8+ $base = dirname( __FILE__ );
 9+ if ( $updater->getDB()->getType() == 'mysql' ) {
 10+ $base = "$base/mysql";
 11+
 12+ $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.sql", true ) );
 13+ $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_filename',
 14+ "$base/archives/patch-acr_filename.sql", true ) );
 15+ $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/archives/patch-account_credentials.sql", true ) );
 16+ $updater->addExtensionUpdate( array( 'addField', 'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) );
 17+ $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) );
 18+ } elseif ( $updater->getDB()->getType() == 'postgres' ) {
 19+ $base = "$base/postgres";
 20+
 21+ $updater->addExtensionUpdate( array( 'addTable', 'account_requests', "$base/ConfirmAccount.pg.sql", true ) );
 22+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
 23+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_filename', "TEXT" ) );
 24+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_storage_key', "TEXT" ) );
 25+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) );
 26+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) );
 27+ $updater->addExtensionUpdate( array( 'addTable', 'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) );
 28+ $updater->addExtensionUpdate( array( 'addPgField', 'account_requests', 'acr_areas', "TEXT" ) );
 29+ $updater->addExtensionUpdate( array( 'addPgField', 'account_credentials', 'acd_areas', "TEXT" ) );
 30+ $updater->addExtensionUpdate( array( 'addIndex', 'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true ) );
 31+ }
 32+ return true;
 33+ }
 34+}
Property changes on: trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php
___________________________________________________________________
Added: svn:eol-style
135 + native

Status & tagging log