http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97984

Revision: 97984
Author:   aaron
Date:     2011-09-24 06:55:01 +0000 (Sat, 24 Sep 2011)
Log Message:
-----------
Refactoring schema change hooks and file locations

Modified Paths:
--------------
    trunk/extensions/ConfirmAccount/ConfirmAccount.php

Added Paths:
-----------
    trunk/extensions/ConfirmAccount/schema/
    trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php
    trunk/extensions/ConfirmAccount/schema/mysql/
    trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql
    trunk/extensions/ConfirmAccount/schema/postgres/
    trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql

Removed Paths:
-------------
    trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql
    trunk/extensions/ConfirmAccount/ConfirmAccount.sql
    trunk/extensions/ConfirmAccount/archives/
    trunk/extensions/ConfirmAccount/postgres/

Deleted: trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql
===================================================================
--- trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql       2011-09-24 
06:13:43 UTC (rev 97983)
+++ trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql       2011-09-24 
06:55:01 UTC (rev 97984)
@@ -1,58 +0,0 @@
--- (c) Aaron Schulz, 2007
-
--- Postgres schema for Confirm Account extension
-
-BEGIN;
-
-CREATE SEQUENCE account_requests_acr_id_seq;
-CREATE TABLE account_requests (
-  acr_id                   INTEGER  PRIMARY KEY NOT NULL DEFAULT 
nextval('account_requests_acr_id_seq'),
-  acr_name                 TEXT      NOT NULL UNIQUE,
-  acr_real_name            TEXT,
-  acr_email                TEXT,
-  acr_email_token          CHAR(32),
-  acr_email_token_expires  TIMESTAMPTZ,
-  acr_email_authenticated  TIMESTAMPTZ,
-  acr_registration         TIMESTAMPTZ,
-  acr_bio                  TEXT,
-  acr_notes                TEXT,
-  acr_urls                 TEXT,
-  acr_ip                   CIDR,
-  acr_filename             TEXT,
-  acr_storage_key          TEXT,
-  acr_type                 INTEGER NOT NULL DEFAULT 0,
-  acr_areas                TEXT,
-  acr_deleted              BOOL      NOT NULL DEFAULT 'false',
-  acr_rejected             TIMESTAMPTZ,
-  acr_held                 TIMESTAMPTZ,
-  acr_user                 INTEGER  REFERENCES mwuser(user_id) ON DELETE SET 
NULL,
-  acr_comment              TEXT     NOT NULL DEFAULT ''
-);
-
-CREATE INDEX acr_type_del_reg ON account_requests 
(acr_type,acr_deleted,acr_registration);
-CREATE INDEX acr_email_token ON account_requests (acr_email_token);
-CREATE UNIQUE INDEX acr_email ON account_requests (acr_email);
-
-CREATE SEQUENCE account_credentials_acd_id_seq;
-CREATE TABLE account_credentials (
-  acd_id                   INTEGER NOT NULL DEFAULT 
nextval('account_credentials_acd_id_seq'),
-  acd_user_id              INTEGER,
-  acd_real_name            TEXT,
-  acd_email                TEXT,
-  acd_email_authenticated  TIMESTAMPTZ,
-  acd_registration         TIMESTAMPTZ,
-  acd_bio                  TEXT,
-  acd_notes                TEXT,
-  acd_urls                 TEXT,
-  acd_ip                   CIDR,
-  acd_filename             TEXT,
-  acd_storage_key          TEXT,
-  acd_areas                TEXT,
-  acd_accepted             TIMESTAMPTZ,
-  acd_user                 INTEGER   REFERENCES mwuser(user_id) ON DELETE SET 
NULL,
-  acd_comment              TEXT       NOT NULL DEFAULT '',
-  PRIMARY KEY (acd_id, acd_user_id)
-);
-CREATE UNIQUE INDEX acd_id_index ON account_credentials (acd_id);
-
-COMMIT;

Modified: trunk/extensions/ConfirmAccount/ConfirmAccount.php
===================================================================
--- trunk/extensions/ConfirmAccount/ConfirmAccount.php  2011-09-24 06:13:43 UTC 
(rev 97983)
+++ trunk/extensions/ConfirmAccount/ConfirmAccount.php  2011-09-24 06:55:01 UTC 
(rev 97984)
@@ -164,6 +164,8 @@
 $wgSpecialPages['UserCredentials'] = 'UserCredentialsPage';
 $wgAutoloadClasses['UserCredentialsPage'] = $dir . 'UserCredentials_body.php';
 $wgSpecialPageGroups['UserCredentials'] = 'users';
+# Schema changes
+$wgAutoloadClasses['ConfirmAccountUpdaterHooks'] = $dir . 
'schema/ConfirmAccountUpdater.hooks.php';
 
 # Make sure "login / create account" notice still as "create account"
 $wgHooks['PersonalUrls'][] = 'ConfirmAccountUIHooks::setRequestLoginLinks';
@@ -177,66 +179,4 @@
 # Register admin pages for AdminLinks extension.
 $wgHooks['AdminLinks'][] = 'ConfirmAccountUIHooks::confirmAccountAdminLinks';
 
-$wgHooks['LoadExtensionSchemaUpdates'][] = 'efConfirmAccountSchemaUpdates';
-
-function efConfirmAccountSchemaUpdates( $updater = null ) {
-       $base = dirname( __FILE__ );
-       if ( $updater === null ) {
-               global $wgDBtype, $wgExtNewFields, $wgExtPGNewFields, 
$wgExtNewTables, $wgExtNewIndexes;
-
-               if ( $wgDBtype == 'mysql' ) {
-                       $wgExtNewTables[] = array( 'account_requests', 
"$base/ConfirmAccount.sql" );
-
-                       $wgExtNewFields[] = array( 'account_requests', 
'acr_filename',
-                               "$base/archives/patch-acr_filename.sql" );
-
-                       $wgExtNewTables[] = array( 'account_credentials', 
"$base/archives/patch-account_credentials.sql" );
-
-                       $wgExtNewFields[] = array( 'account_requests', 
'acr_areas', "$base/archives/patch-acr_areas.sql" );
-
-                       $wgExtNewIndexes[] = array( 'account_requests', 
'acr_email', "$base/archives/patch-email-index.sql" );
-               } elseif ( $wgDBtype == 'postgres' ) {
-                       $wgExtNewTables[] = array( 'account_requests', 
"$base/ConfirmAccount.pg.sql" );
-
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_held', "TIMESTAMPTZ" );
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_filename', "TEXT" );
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_storage_key', "TEXT" );
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_comment', "TEXT NOT NULL DEFAULT ''" );
-
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_type', "INTEGER NOT NULL DEFAULT 0" );
-                       $wgExtNewTables[] = array( 'account_credentials', 
"$base/postgres/patch-account_credentials.sql" );
-                       $wgExtPGNewFields[] = array( 'account_requests', 
'acr_areas', "TEXT" );
-                       $wgExtPGNewFields[] = array( 'account_credentials', 
'acd_areas', "TEXT" );
-
-                       $wgExtNewIndexes[] = array( 'account_requests', 
'acr_email', "$base/postgres/patch-email-index.sql" );
-               }
-       } else {
-               if ( $updater->getDB()->getType() == 'mysql' ) {
-                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.sql", true ) );
-
-                       $updater->addExtensionUpdate( array( 'addField', 
'account_requests', 'acr_filename',
-                               "$base/archives/patch-acr_filename.sql", true ) 
);
-
-                       $updater->addExtensionUpdate( array( 'addTable', 
'account_credentials', "$base/archives/patch-account_credentials.sql", true ) );
-
-                       $updater->addExtensionUpdate( array( 'addField', 
'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) );
-
-                       $updater->addExtensionUpdate( array( 'addIndex', 
'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) 
);
-               } elseif ( $updater->getDB()->getType() == 'postgres' ) {
-                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.pg.sql", true ) );
-
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_filename', "TEXT" ) );
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_storage_key', "TEXT" ) );
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) );
-
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) );
-                       $updater->addExtensionUpdate( array( 'addTable', 
'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) );
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_areas', "TEXT" ) );
-                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_credentials', 'acd_areas', "TEXT" ) );
-
-                       $updater->addExtensionUpdate( array( 'addIndex', 
'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true ) 
);
-               }
-       }
-       return true;
-}
+$wgHooks['LoadExtensionSchemaUpdates'][] = 
'ConfirmAccountUpdaterHooks::addSchemaUpdates';

Deleted: trunk/extensions/ConfirmAccount/ConfirmAccount.sql
===================================================================
--- trunk/extensions/ConfirmAccount/ConfirmAccount.sql  2011-09-24 06:13:43 UTC 
(rev 97983)
+++ trunk/extensions/ConfirmAccount/ConfirmAccount.sql  2011-09-24 06:55:01 UTC 
(rev 97984)
@@ -1,107 +0,0 @@
--- (c) Aaron Schulz, 2007
-
--- Table structure for table `Confirm account`
--- Replace /*$wgDBprefix*/ with the proper prefix
-
--- This stores all of our reviews,
--- the corresponding tags are stored in the tag table
-CREATE TABLE IF NOT EXISTS /*_*/account_requests (
-  acr_id int unsigned NOT NULL auto_increment PRIMARY KEY,
-  -- Usernames must be unique, must not be in the form of
-  -- an IP address. _Shouldn't_ allow slashes or case
-  -- conflicts. Spaces are allowed, and are _not_ converted
-  -- to underscores like titles. See the User::newFromName() for
-  -- the specific tests that usernames have to pass.
-  acr_name varchar(255) binary NOT NULL default '',
-  -- Optional 'real name' to be displayed in credit listings
-  acr_real_name varchar(255) binary NOT NULL default '',
-  -- Note: email should be restricted, not public info.
-  -- Same with passwords.
-  acr_email tinytext NOT NULL,
-  -- Initially NULL; when a user's e-mail address has been
-  -- validated by returning with a mailed token, this is
-  -- set to the current timestamp.
-  acr_email_authenticated binary(14) default NULL,
-  -- Randomly generated token created when the e-mail address
-  -- is set and a confirmation test mail sent.
-  acr_email_token binary(32),
-  -- Expiration date for the user_email_token
-  acr_email_token_expires binary(14),
-  -- A little about this user
-  acr_bio mediumblob NOT NULL,
-  -- Private info for reviewers to look at when considering request
-  acr_notes mediumblob NOT NULL,
-  -- Links to recognize/identify this user, CSV, may not be public
-  acr_urls mediumblob NOT NULL,
-  -- IP address
-  acr_ip VARCHAR(255) NULL default '',
-  -- Name of attached file (.pdf,.doc,.txt etc...)
-  acr_filename VARCHAR(255) NULL,
-  acr_storage_key VARCHAR(64) NULL,
-  -- Prospective account access level
-  acr_type tinyint(255) unsigned NOT NULL default 0,
-  -- Areas of interest
-  acr_areas mediumblob NOT NULL,
-
-  -- Timestamp of account registration.
-  acr_registration char(14) NOT NULL,
-
-  -- Flag for rejected accounts
-  acr_deleted bool NOT NULL,
-  -- Time of rejection (if rejected)
-  acr_rejected binary(14),
-  -- Time request was put on hold (if held)
-  acr_held binary(14),
-  -- The user who rejected/held it
-  acr_user int unsigned NOT NULL default 0,
-  -- Reason
-  acr_comment varchar(255) NOT NULL default ''
-) /*$wgDBTableOptions*/;
-
-CREATE UNIQUE INDEX /*i*/acr_name ON /*_*/account_requests (acr_name);
-CREATE UNIQUE INDEX /*i*/acr_email ON /*_*/account_requests (acr_email(255));
-CREATE INDEX /*i*/acr_email_token ON /*_*/account_requests (acr_email_token);
-CREATE INDEX /*i*/acr_type_del_reg ON /*_*/account_requests 
(acr_type,acr_deleted,acr_registration);
-
--- This stores all of credential information
--- When accounts are confirmed, the identity info goes here
-CREATE TABLE IF NOT EXISTS /*_*/account_credentials (
-  -- Revision ID #
-  acd_id int unsigned NOT NULL auto_increment PRIMARY KEY,
-  -- Foreign key to user.user_id
-  acd_user_id int unsigned NOT NULL,
-  -- Optional 'real name' to be displayed in credit listings
-  acd_real_name varchar(255) binary NOT NULL default '',
-  -- Note: email should be restricted, not public info.
-  -- Same with passwords.
-  acd_email tinytext NOT NULL,
-  -- Initially NULL; when a user's e-mail address has been
-  -- validated by returning with a mailed token, this is
-  -- set to the current timestamp.
-  acd_email_authenticated binary(14) default NULL,
-  -- A little about this user
-  acd_bio mediumblob NOT NULL,
-  -- Private info for reviewers to look at when considering request
-  acd_notes mediumblob NOT NULL,
-  -- Links to recognize/identify this user, CSV, may not be public
-  acd_urls mediumblob NOT NULL,
-  -- IP address
-  acd_ip VARCHAR(255) NULL default '',
-  -- Name of attached file (.pdf,.doc,.txt etc...)
-  acd_filename VARCHAR(255) NULL,
-  acd_storage_key VARCHAR(64) NULL,
-  -- Areas of interest
-  acd_areas mediumblob NOT NULL,
-
-  -- Timestamp of account registration.
-  acd_registration char(14) NOT NULL,
-
-  -- Timestamp of acceptance
-  acd_accepted binary(14),
-  -- The user who accepted it
-  acd_user int unsigned NOT NULL default 0,
-  -- Reason given in email
-  acd_comment varchar(255) NOT NULL default ''
-) /*$wgDBTableOptions*/;
-
-CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials 
(acd_user_id,acd_id);

Copied: trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php 
(from rev 97981, trunk/extensions/ConfirmAccount/ConfirmAccount.php)
===================================================================
--- trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php      
                        (rev 0)
+++ trunk/extensions/ConfirmAccount/schema/ConfirmAccountUpdater.hooks.php      
2011-09-24 06:55:01 UTC (rev 97984)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Class containing updater functions for a ConfirmAccount environment
+ */
+class ConfirmAccountUpdaterHooks {
+       public static function addSchemaUpdates( DatabaseUpdater $updater ) {
+               $base = dirname( __FILE__ );
+               if ( $updater->getDB()->getType() == 'mysql' ) {
+                       $base = "$base/mysql";
+
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.sql", true ) );
+                       $updater->addExtensionUpdate( array( 'addField', 
'account_requests', 'acr_filename',
+                               "$base/archives/patch-acr_filename.sql", true ) 
);
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_credentials', "$base/archives/patch-account_credentials.sql", true ) );
+                       $updater->addExtensionUpdate( array( 'addField', 
'account_requests', 'acr_areas', "$base/archives/patch-acr_areas.sql", true ) );
+                       $updater->addExtensionUpdate( array( 'addIndex', 
'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) 
);
+               } elseif ( $updater->getDB()->getType() == 'postgres' ) {
+                       $base = "$base/postgres";
+
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.pg.sql", true ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_filename', "TEXT" ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_storage_key', "TEXT" ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_comment', "TEXT NOT NULL DEFAULT ''" ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_type', "INTEGER NOT NULL DEFAULT 0" ) );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_credentials', "$base/postgres/patch-account_credentials.sql", true ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_areas', "TEXT" ) );
+                       $updater->addExtensionUpdate( array( 'addPgField', 
'account_credentials', 'acd_areas', "TEXT" ) );
+                       $updater->addExtensionUpdate( array( 'addIndex', 
'account_requests', 'acr_email', "$base/postgres/patch-email-index.sql", true ) 
);
+               }
+               return true;
+       }
+}

Copied: trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql (from 
rev 97981, trunk/extensions/ConfirmAccount/ConfirmAccount.sql)
===================================================================
--- trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql             
                (rev 0)
+++ trunk/extensions/ConfirmAccount/schema/mysql/ConfirmAccount.sql     
2011-09-24 06:55:01 UTC (rev 97984)
@@ -0,0 +1,107 @@
+-- (c) Aaron Schulz, 2007
+
+-- Table structure for table `Confirm account`
+-- Replace /*$wgDBprefix*/ with the proper prefix
+
+-- This stores all of our reviews,
+-- the corresponding tags are stored in the tag table
+CREATE TABLE IF NOT EXISTS /*_*/account_requests (
+  acr_id int unsigned NOT NULL auto_increment PRIMARY KEY,
+  -- Usernames must be unique, must not be in the form of
+  -- an IP address. _Shouldn't_ allow slashes or case
+  -- conflicts. Spaces are allowed, and are _not_ converted
+  -- to underscores like titles. See the User::newFromName() for
+  -- the specific tests that usernames have to pass.
+  acr_name varchar(255) binary NOT NULL default '',
+  -- Optional 'real name' to be displayed in credit listings
+  acr_real_name varchar(255) binary NOT NULL default '',
+  -- Note: email should be restricted, not public info.
+  -- Same with passwords.
+  acr_email tinytext NOT NULL,
+  -- Initially NULL; when a user's e-mail address has been
+  -- validated by returning with a mailed token, this is
+  -- set to the current timestamp.
+  acr_email_authenticated binary(14) default NULL,
+  -- Randomly generated token created when the e-mail address
+  -- is set and a confirmation test mail sent.
+  acr_email_token binary(32),
+  -- Expiration date for the user_email_token
+  acr_email_token_expires binary(14),
+  -- A little about this user
+  acr_bio mediumblob NOT NULL,
+  -- Private info for reviewers to look at when considering request
+  acr_notes mediumblob NOT NULL,
+  -- Links to recognize/identify this user, CSV, may not be public
+  acr_urls mediumblob NOT NULL,
+  -- IP address
+  acr_ip VARCHAR(255) NULL default '',
+  -- Name of attached file (.pdf,.doc,.txt etc...)
+  acr_filename VARCHAR(255) NULL,
+  acr_storage_key VARCHAR(64) NULL,
+  -- Prospective account access level
+  acr_type tinyint(255) unsigned NOT NULL default 0,
+  -- Areas of interest
+  acr_areas mediumblob NOT NULL,
+
+  -- Timestamp of account registration.
+  acr_registration char(14) NOT NULL,
+
+  -- Flag for rejected accounts
+  acr_deleted bool NOT NULL,
+  -- Time of rejection (if rejected)
+  acr_rejected binary(14),
+  -- Time request was put on hold (if held)
+  acr_held binary(14),
+  -- The user who rejected/held it
+  acr_user int unsigned NOT NULL default 0,
+  -- Reason
+  acr_comment varchar(255) NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/acr_name ON /*_*/account_requests (acr_name);
+CREATE UNIQUE INDEX /*i*/acr_email ON /*_*/account_requests (acr_email(255));
+CREATE INDEX /*i*/acr_email_token ON /*_*/account_requests (acr_email_token);
+CREATE INDEX /*i*/acr_type_del_reg ON /*_*/account_requests 
(acr_type,acr_deleted,acr_registration);
+
+-- This stores all of credential information
+-- When accounts are confirmed, the identity info goes here
+CREATE TABLE IF NOT EXISTS /*_*/account_credentials (
+  -- Revision ID #
+  acd_id int unsigned NOT NULL auto_increment PRIMARY KEY,
+  -- Foreign key to user.user_id
+  acd_user_id int unsigned NOT NULL,
+  -- Optional 'real name' to be displayed in credit listings
+  acd_real_name varchar(255) binary NOT NULL default '',
+  -- Note: email should be restricted, not public info.
+  -- Same with passwords.
+  acd_email tinytext NOT NULL,
+  -- Initially NULL; when a user's e-mail address has been
+  -- validated by returning with a mailed token, this is
+  -- set to the current timestamp.
+  acd_email_authenticated binary(14) default NULL,
+  -- A little about this user
+  acd_bio mediumblob NOT NULL,
+  -- Private info for reviewers to look at when considering request
+  acd_notes mediumblob NOT NULL,
+  -- Links to recognize/identify this user, CSV, may not be public
+  acd_urls mediumblob NOT NULL,
+  -- IP address
+  acd_ip VARCHAR(255) NULL default '',
+  -- Name of attached file (.pdf,.doc,.txt etc...)
+  acd_filename VARCHAR(255) NULL,
+  acd_storage_key VARCHAR(64) NULL,
+  -- Areas of interest
+  acd_areas mediumblob NOT NULL,
+
+  -- Timestamp of account registration.
+  acd_registration char(14) NOT NULL,
+
+  -- Timestamp of acceptance
+  acd_accepted binary(14),
+  -- The user who accepted it
+  acd_user int unsigned NOT NULL default 0,
+  -- Reason given in email
+  acd_comment varchar(255) NOT NULL default ''
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/acd_user_id ON /*_*/account_credentials 
(acd_user_id,acd_id);

Copied: trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql 
(from rev 97981, trunk/extensions/ConfirmAccount/ConfirmAccount.pg.sql)
===================================================================
--- trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql       
                        (rev 0)
+++ trunk/extensions/ConfirmAccount/schema/postgres/ConfirmAccount.pg.sql       
2011-09-24 06:55:01 UTC (rev 97984)
@@ -0,0 +1,58 @@
+-- (c) Aaron Schulz, 2007
+
+-- Postgres schema for Confirm Account extension
+
+BEGIN;
+
+CREATE SEQUENCE account_requests_acr_id_seq;
+CREATE TABLE account_requests (
+  acr_id                   INTEGER  PRIMARY KEY NOT NULL DEFAULT 
nextval('account_requests_acr_id_seq'),
+  acr_name                 TEXT      NOT NULL UNIQUE,
+  acr_real_name            TEXT,
+  acr_email                TEXT,
+  acr_email_token          CHAR(32),
+  acr_email_token_expires  TIMESTAMPTZ,
+  acr_email_authenticated  TIMESTAMPTZ,
+  acr_registration         TIMESTAMPTZ,
+  acr_bio                  TEXT,
+  acr_notes                TEXT,
+  acr_urls                 TEXT,
+  acr_ip                   CIDR,
+  acr_filename             TEXT,
+  acr_storage_key          TEXT,
+  acr_type                 INTEGER NOT NULL DEFAULT 0,
+  acr_areas                TEXT,
+  acr_deleted              BOOL      NOT NULL DEFAULT 'false',
+  acr_rejected             TIMESTAMPTZ,
+  acr_held                 TIMESTAMPTZ,
+  acr_user                 INTEGER  REFERENCES mwuser(user_id) ON DELETE SET 
NULL,
+  acr_comment              TEXT     NOT NULL DEFAULT ''
+);
+
+CREATE INDEX acr_type_del_reg ON account_requests 
(acr_type,acr_deleted,acr_registration);
+CREATE INDEX acr_email_token ON account_requests (acr_email_token);
+CREATE UNIQUE INDEX acr_email ON account_requests (acr_email);
+
+CREATE SEQUENCE account_credentials_acd_id_seq;
+CREATE TABLE account_credentials (
+  acd_id                   INTEGER NOT NULL DEFAULT 
nextval('account_credentials_acd_id_seq'),
+  acd_user_id              INTEGER,
+  acd_real_name            TEXT,
+  acd_email                TEXT,
+  acd_email_authenticated  TIMESTAMPTZ,
+  acd_registration         TIMESTAMPTZ,
+  acd_bio                  TEXT,
+  acd_notes                TEXT,
+  acd_urls                 TEXT,
+  acd_ip                   CIDR,
+  acd_filename             TEXT,
+  acd_storage_key          TEXT,
+  acd_areas                TEXT,
+  acd_accepted             TIMESTAMPTZ,
+  acd_user                 INTEGER   REFERENCES mwuser(user_id) ON DELETE SET 
NULL,
+  acd_comment              TEXT       NOT NULL DEFAULT '',
+  PRIMARY KEY (acd_id, acd_user_id)
+);
+CREATE UNIQUE INDEX acd_id_index ON account_credentials (acd_id);
+
+COMMIT;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to