[feature/oauth] Finalize schema changes

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-23 22:15:53 -04:00
parent 8d568dae71
commit e60f4bc88b
10 changed files with 180 additions and 10 deletions

View file

@ -1,6 +1,6 @@
parameters:
tables.auth_provider_oauth_token_storage: %core.table_prefix%auth_provider_oauth_token_storage
tables.auth_provider_oauth_account_assoc: %core.table_prefix%auth_provider_oauth_account_assoc
tables.auth_provider_oauth_token_storage: %core.table_prefix%oauth_token
tables.auth_provider_oauth_account_assoc: %core.table_prefix%oauth_accounts
tables.config: %core.table_prefix%config
tables.config_text: %core.table_prefix%config_text
tables.ext: %core.table_prefix%ext

View file

@ -923,28 +923,28 @@ function get_schema_struct()
),
);
$schemda_data['auth_provider_oauth_token_storage'] = array(
$schema_data['phpbb_oauth_tokens'] = array(
'COLUMNS' => array(
'user_id' => array('UINT', 0), // phpbb_users.user_id
'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
'oauth_provider' => array('VCHAR'), // Name of the OAuth provider
'provider' => array('VCHAR'), // Name of the OAuth provider
'oauth_token' => array('TEXT_UNI'), // Serialized token
),
'KEYS' => array(
'user_id' => array('INDEX', 'user_id'),
'oauth_provider' => array('INDEX', 'oauth_provider'),
'provider' => array('INDEX', 'oauth_provider'),
),
);
$schemda_data['auth_provider_oauth_account_assoc'] = array(
$schema_data['phpbb_oauth_accounts'] = array(
'COLUMNS' => array(
'user_id' => array('UINT', 0),
'oauth_provider' => array('VCHAR'),
'provider' => array('VCHAR'),
'oauth_provider_id' => array('TEXT_UNI'),
),
'PRIMARY_KEY' => array(
'user_id',
'oauth_provider',
'provider',
),
);

View file

@ -128,6 +128,27 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);;
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);;
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);;
# Table: 'phpbb_oauth_tokens'
CREATE TABLE phpbb_oauth_tokens (
user_id INTEGER DEFAULT 0 NOT NULL,
session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL,
provider VARCHAR(255) CHARACTER SET NONE NOT NULL,
oauth_token BLOB SUB_TYPE TEXT CHARACTER SET UTF8 NOT NULL
);;
CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens(user_id);;
CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens(oauth_provider);;
# Table: 'phpbb_oauth_accounts'
CREATE TABLE phpbb_oauth_accounts (
user_id INTEGER DEFAULT 0 NOT NULL,
provider VARCHAR(255) CHARACTER SET NONE NOT NULL,
oauth_provider_id BLOB SUB_TYPE TEXT CHARACTER SET UTF8 NOT NULL
);;
ALTER TABLE phpbb_oauth_accounts ADD PRIMARY KEY (user_id, provider);;
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id INTEGER NOT NULL,

View file

@ -166,6 +166,43 @@ CREATE INDEX [auth_role_id] ON [phpbb_acl_users]([auth_role_id]) ON [PRIMARY]
GO
/*
Table: 'phpbb_oauth_tokens'
*/
CREATE TABLE [phpbb_oauth_tokens] (
[user_id] [int] DEFAULT (0) NOT NULL ,
[session_id] [char] (32) DEFAULT ('') NOT NULL ,
[provider] [varchar] (255) NOT NULL ,
[oauth_token] [varchar] (4000) NOT NULL
) ON [PRIMARY]
GO
CREATE INDEX [user_id] ON [phpbb_oauth_tokens]([user_id]) ON [PRIMARY]
GO
CREATE INDEX [provider] ON [phpbb_oauth_tokens]([oauth_provider]) ON [PRIMARY]
GO
/*
Table: 'phpbb_oauth_accounts'
*/
CREATE TABLE [phpbb_oauth_accounts] (
[user_id] [int] DEFAULT (0) NOT NULL ,
[provider] [varchar] (255) NOT NULL ,
[oauth_provider_id] [varchar] (4000) NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [phpbb_oauth_accounts] WITH NOCHECK ADD
CONSTRAINT [PK_phpbb_oauth_accounts] PRIMARY KEY CLUSTERED
(
[user_id],
[provider]
) ON [PRIMARY]
GO
/*
Table: 'phpbb_banlist'
*/

View file

@ -90,6 +90,26 @@ CREATE TABLE phpbb_acl_users (
);
# Table: 'phpbb_oauth_tokens'
CREATE TABLE phpbb_oauth_tokens (
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
session_id binary(32) DEFAULT '' NOT NULL,
provider varbinary(255) NOT NULL,
oauth_token blob NOT NULL,
KEY user_id (user_id),
KEY provider (oauth_provider)
);
# Table: 'phpbb_oauth_accounts'
CREATE TABLE phpbb_oauth_accounts (
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
provider varbinary(255) NOT NULL,
oauth_provider_id blob NOT NULL,
PRIMARY KEY (user_id, provider)
);
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id mediumint(8) UNSIGNED NOT NULL auto_increment,

View file

@ -90,6 +90,26 @@ CREATE TABLE phpbb_acl_users (
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_oauth_tokens'
CREATE TABLE phpbb_oauth_tokens (
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
session_id char(32) DEFAULT '' NOT NULL,
provider varchar(255) NOT NULL,
oauth_token text NOT NULL,
KEY user_id (user_id),
KEY provider (oauth_provider)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_oauth_accounts'
CREATE TABLE phpbb_oauth_accounts (
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
provider varchar(255) NOT NULL,
oauth_provider_id text NOT NULL,
PRIMARY KEY (user_id, provider)
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id mediumint(8) UNSIGNED NOT NULL auto_increment,

View file

@ -210,6 +210,34 @@ CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id)
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id)
/
/*
Table: 'phpbb_oauth_tokens'
*/
CREATE TABLE phpbb_oauth_tokens (
user_id number(8) DEFAULT '0' NOT NULL,
session_id char(32) DEFAULT '' ,
provider varchar2(255) NOT NULL,
oauth_token clob NOT NULL
)
/
CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id)
/
CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (oauth_provider)
/
/*
Table: 'phpbb_oauth_accounts'
*/
CREATE TABLE phpbb_oauth_accounts (
user_id number(8) DEFAULT '0' NOT NULL,
provider varchar2(255) NOT NULL,
oauth_provider_id clob NOT NULL,
CONSTRAINT pk_phpbb_oauth_accounts PRIMARY KEY (user_id, provider)
)
/
/*
Table: 'phpbb_banlist'
*/

View file

@ -188,6 +188,30 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
/*
Table: 'phpbb_oauth_tokens'
*/
CREATE TABLE phpbb_oauth_tokens (
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
session_id char(32) DEFAULT '' NOT NULL,
provider varchar(255) NOT NULL,
oauth_token varchar(4000) NOT NULL
);
CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id);
CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (oauth_provider);
/*
Table: 'phpbb_oauth_accounts'
*/
CREATE TABLE phpbb_oauth_accounts (
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
provider varchar(255) NOT NULL,
oauth_provider_id varchar(4000) NOT NULL,
PRIMARY KEY (user_id, provider)
);
/*
Table: 'phpbb_banlist'
*/

View file

@ -89,6 +89,26 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
# Table: 'phpbb_oauth_tokens'
CREATE TABLE phpbb_oauth_tokens (
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
session_id char(32) NOT NULL DEFAULT '',
provider varchar(255) NOT NULL ,
oauth_token text(65535) NOT NULL
);
CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id);
CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (oauth_provider);
# Table: 'phpbb_oauth_accounts'
CREATE TABLE phpbb_oauth_accounts (
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
provider varchar(255) NOT NULL ,
oauth_provider_id text(65535) NOT NULL ,
PRIMARY KEY (user_id, provider)
);
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id INTEGER PRIMARY KEY NOT NULL ,

View file

@ -18,7 +18,7 @@ class phpbb_db_migration_data_310_auth_provider_oauth extends phpbb_db_migration
{
return array(
'add_tables' => array(
$this->table_prefix . 'auth_provider_oauth_token_storage' => array(
$this->table_prefix . 'oauth_token' => array(
'COLUMNS' => array(
'user_id' => array('UINT', 0), // phpbb_users.user_id
'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
@ -30,7 +30,7 @@ class phpbb_db_migration_data_310_auth_provider_oauth extends phpbb_db_migration
'oauth_provider' => array('INDEX', 'oauth_provider'),
),
),
$this->table_prefix . 'auth_provider_oauth_account_assoc' => array(
$this->table_prefix . 'oauth_accounts' => array(
'COLUMNS' => array(
'user_id' => array('UINT', 0),
'oauth_provider' => array('VCHAR'),