Migrate bot_passwords table to abstract schema
bot_passwords.bp_token didn't have a default in Postgres while it has one in MySQL (and Sqlite), so adding the default to Postgres as well Bug: T230428 Bug: T164898 Change-Id: I0ae4dbf8f2a5382081c6211c9cad51843000e3f1
This commit is contained in:
parent
f4c7bb1a60
commit
b36210cae2
7 changed files with 73 additions and 36 deletions
|
|
@ -697,6 +697,7 @@ class PostgresUpdater extends DatabaseUpdater {
|
|||
[ 'changeField', 'actor', 'actor_name', 'TEXT', '' ],
|
||||
[ 'changeField', 'user_former_groups', 'ufg_group', 'TEXT', '' ],
|
||||
[ 'dropFkey', 'user_former_groups', 'ufg_user' ],
|
||||
[ 'setDefault', 'bot_passwords', 'bp_token', '' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,4 +27,13 @@ CREATE TABLE user_former_groups (
|
|||
ufg_user INT DEFAULT 0 NOT NULL,
|
||||
ufg_group TEXT DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY(ufg_user, ufg_group)
|
||||
);
|
||||
CREATE TABLE bot_passwords (
|
||||
bp_user INT NOT NULL,
|
||||
bp_app_id TEXT NOT NULL,
|
||||
bp_password TEXT NOT NULL,
|
||||
bp_token TEXT DEFAULT '' NOT NULL,
|
||||
bp_restrictions TEXT NOT NULL,
|
||||
bp_grants TEXT NOT NULL,
|
||||
PRIMARY KEY(bp_user, bp_app_id)
|
||||
);
|
||||
|
|
@ -77,16 +77,6 @@ CREATE TABLE user_newtalk (
|
|||
CREATE INDEX user_newtalk_id_idx ON user_newtalk (user_id);
|
||||
CREATE INDEX user_newtalk_ip_idx ON user_newtalk (user_ip);
|
||||
|
||||
CREATE TABLE bot_passwords (
|
||||
bp_user INTEGER NOT NULL,
|
||||
bp_app_id TEXT NOT NULL,
|
||||
bp_password TEXT NOT NULL,
|
||||
bp_token TEXT NOT NULL,
|
||||
bp_restrictions TEXT NOT NULL,
|
||||
bp_grants TEXT NOT NULL,
|
||||
PRIMARY KEY ( bp_user, bp_app_id )
|
||||
);
|
||||
|
||||
CREATE SEQUENCE page_page_id_seq;
|
||||
CREATE TABLE page (
|
||||
page_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('page_page_id_seq'),
|
||||
|
|
|
|||
|
|
@ -26,4 +26,13 @@ CREATE TABLE /*_*/user_former_groups (
|
|||
ufg_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
|
||||
ufg_group BLOB DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY(ufg_user, ufg_group)
|
||||
);
|
||||
CREATE TABLE /*_*/bot_passwords (
|
||||
bp_user INTEGER UNSIGNED NOT NULL,
|
||||
bp_app_id BLOB NOT NULL,
|
||||
bp_password BLOB NOT NULL,
|
||||
bp_token BLOB DEFAULT '' NOT NULL,
|
||||
bp_restrictions BLOB NOT NULL,
|
||||
bp_grants BLOB NOT NULL,
|
||||
PRIMARY KEY(bp_user, bp_app_id)
|
||||
);
|
||||
|
|
@ -31,3 +31,13 @@ CREATE TABLE /*_*/user_former_groups (
|
|||
ufg_group VARBINARY(255) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY(ufg_user, ufg_group)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
CREATE TABLE /*_*/bot_passwords (
|
||||
bp_user INT UNSIGNED NOT NULL,
|
||||
bp_app_id VARBINARY(32) NOT NULL,
|
||||
bp_password TINYBLOB NOT NULL,
|
||||
bp_token BINARY(32) DEFAULT '' NOT NULL,
|
||||
bp_restrictions BLOB NOT NULL,
|
||||
bp_grants BLOB NOT NULL,
|
||||
PRIMARY KEY(bp_user, bp_app_id)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
|
|
|||
|
|
@ -93,5 +93,49 @@
|
|||
],
|
||||
"indexes": [],
|
||||
"pk": [ "ufg_user", "ufg_group" ]
|
||||
},
|
||||
{
|
||||
"name": "bot_passwords",
|
||||
"comment": "This table contains a user's bot passwords: passwords that allow access to the account via the API with limited rights.",
|
||||
"columns": [
|
||||
{
|
||||
"name": "bp_user",
|
||||
"comment": "User ID obtained from CentralIdLookup.",
|
||||
"type": "integer",
|
||||
"options": { "unsigned": true, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "bp_app_id",
|
||||
"comment": "Application identifier.",
|
||||
"type": "binary",
|
||||
"options": { "length": 32, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "bp_password",
|
||||
"comment": "Password hashes, like user.user_password.",
|
||||
"type": "blob",
|
||||
"options": { "length": 255, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "bp_token",
|
||||
"comment": "Like user.user_token",
|
||||
"type": "binary",
|
||||
"options": { "length": 32, "notnull": true, "default": "", "fixed": true }
|
||||
},
|
||||
{
|
||||
"name": "bp_restrictions",
|
||||
"comment": "JSON blob for MWRestrictions",
|
||||
"type": "blob",
|
||||
"options": { "length": 65535, "notnull": true }
|
||||
},
|
||||
{
|
||||
"name": "bp_grants",
|
||||
"comment": "Grants allowed to the account when authenticated with this bot-password",
|
||||
"type": "blob",
|
||||
"options": { "length": 65535, "notnull": true }
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"pk": [ "bp_user", "bp_app_id" ]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -214,32 +214,6 @@ CREATE TABLE /*_*/user_properties (
|
|||
|
||||
CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
|
||||
|
||||
--
|
||||
-- This table contains a user's bot passwords: passwords that allow access to
|
||||
-- the account via the API with limited rights.
|
||||
--
|
||||
CREATE TABLE /*_*/bot_passwords (
|
||||
-- User ID obtained from CentralIdLookup.
|
||||
bp_user int unsigned NOT NULL,
|
||||
|
||||
-- Application identifier
|
||||
bp_app_id varbinary(32) NOT NULL,
|
||||
|
||||
-- Password hashes, like user.user_password
|
||||
bp_password tinyblob NOT NULL,
|
||||
|
||||
-- Like user.user_token
|
||||
bp_token binary(32) NOT NULL default '',
|
||||
|
||||
-- JSON blob for MWRestrictions
|
||||
bp_restrictions blob NOT NULL,
|
||||
|
||||
-- Grants allowed to the account when authenticated with this bot-password
|
||||
bp_grants blob NOT NULL,
|
||||
|
||||
PRIMARY KEY ( bp_user, bp_app_id )
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
--
|
||||
-- Core of the wiki: each page has an entry here which identifies
|
||||
-- it by title and contains some essential metadata.
|
||||
|
|
|
|||
Loading…
Reference in a new issue