Convert to abstract schema
Bug: T361920 Change-Id: I28f450a4f5c4e1784b4e7e8c8e1fa694bfac4d14
这个提交包含在:
父节点
75cb81c2e6
当前提交
bb40f4f232
|
@ -165,9 +165,21 @@ class GlobalUserrightsHooks {
|
|||
*/
|
||||
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
|
||||
$dir = __DIR__;
|
||||
$updater->addExtensionTable( 'global_user_groups', $dir . '/../sql/global_user_groups.sql' );
|
||||
|
||||
$dir .= '/../db_patches';
|
||||
$dbType = $updater->getDB()->getType();
|
||||
$dir = dirname( __DIR__ ) . '/sql/';
|
||||
|
||||
$updater->addExtensionTable(
|
||||
'global_user_groups',
|
||||
"$dir/$dbType/tables-generated.sql"
|
||||
);
|
||||
|
||||
$dir = dirname( __DIR__ ) . '/db_patches';
|
||||
|
||||
if ( $dbType === 'postgres' ) {
|
||||
// Currently no schema changes with postgres, bail out
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the table with the new definitions
|
||||
// This ensures backwards compatibility
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
-- Additional table for the GlobalUserrights extension
|
||||
-- To be added to $wgSharedDB
|
||||
|
||||
CREATE TABLE /*_*/global_user_groups (
|
||||
-- Key to user_id
|
||||
gug_user int unsigned NOT NULL default 0,
|
||||
-- Group name
|
||||
gug_group varbinary(255) NOT NULL default '',
|
||||
-- Expiry date
|
||||
gug_expiry varbinary(14) NULL default NULL,
|
||||
|
||||
PRIMARY KEY (gug_user, gug_group)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
CREATE INDEX /*i*/gug_group ON /*_*/global_user_groups (gug_group);
|
||||
CREATE INDEX /*i*/gug_expiry ON /*_*/global_user_groups (gug_expiry);
|
|
@ -0,0 +1,12 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: /var/www/wiki/mediawiki/extensions/GlobalUserrights/sql/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE /*_*/global_user_groups (
|
||||
gug_user BIGINT UNSIGNED NOT NULL,
|
||||
gug_group VARBINARY(255) DEFAULT '' NOT NULL,
|
||||
gug_expiry BINARY(14) NOT NULL,
|
||||
INDEX gug_group (gug_group),
|
||||
INDEX gug_expiry (gug_expiry),
|
||||
PRIMARY KEY(gug_user, gug_group)
|
||||
) /*$wgDBTableOptions*/;
|
|
@ -0,0 +1,14 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: /var/www/wiki/mediawiki/extensions/GlobalUserrights/sql/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE global_user_groups (
|
||||
gug_user BIGINT NOT NULL,
|
||||
gug_group TEXT DEFAULT '' NOT NULL,
|
||||
gug_expiry TIMESTAMPTZ NOT NULL,
|
||||
PRIMARY KEY(gug_user, gug_group)
|
||||
);
|
||||
|
||||
CREATE INDEX gug_group ON global_user_groups (gug_group);
|
||||
|
||||
CREATE INDEX gug_expiry ON global_user_groups (gug_expiry);
|
|
@ -0,0 +1,14 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaSql.php.
|
||||
-- Source: /var/www/wiki/mediawiki/extensions/GlobalUserrights/sql/tables.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
CREATE TABLE /*_*/global_user_groups (
|
||||
gug_user BIGINT UNSIGNED NOT NULL,
|
||||
gug_group BLOB DEFAULT '' NOT NULL,
|
||||
gug_expiry BLOB NOT NULL,
|
||||
PRIMARY KEY(gug_user, gug_group)
|
||||
);
|
||||
|
||||
CREATE INDEX gug_group ON /*_*/global_user_groups (gug_group);
|
||||
|
||||
CREATE INDEX gug_expiry ON /*_*/global_user_groups (gug_expiry);
|
|
@ -0,0 +1,30 @@
|
|||
[
|
||||
{
|
||||
"name": "global_user_groups",
|
||||
"columns": [
|
||||
{
|
||||
"name": "gug_user",
|
||||
"comment": "Key to user_id",
|
||||
"type": "bigint",
|
||||
"options": { "unsigned": true, "notnull": true, "autoincrement": false }
|
||||
},
|
||||
{
|
||||
"name": "gug_group",
|
||||
"comment": "Group name",
|
||||
"type": "binary",
|
||||
"options": { "length": 255, "default": "", "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "gug_expiry",
|
||||
"comment": "Text username or IP address",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "notnull": true }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{ "name": "gug_group", "columns": [ "gug_group" ], "unique": false },
|
||||
{ "name": "gug_expiry", "columns": [ "gug_expiry" ], "unique": false }
|
||||
],
|
||||
"pk": [ "gug_user", "gug_group" ]
|
||||
}
|
||||
]
|
正在加载...
在新工单中引用