mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-11 16:59:40 +00:00
First phase of T175177 database alter table adds two fields
* Adds template and tag name fields to enable better search capability to the Linter extension Bug: T175177 Change-Id: Iac22d99109bb1253f450a64254f50677e3cdefeb
This commit is contained in:
parent
ead506534f
commit
56567da56f
|
@ -44,6 +44,9 @@ class Hooks {
|
|||
$updater->addExtensionField( 'linter', 'linter_namespace',
|
||||
dirname( __DIR__ ) . '/sql/patch-linter-add-namespace.sql'
|
||||
);
|
||||
$updater->addExtensionField( 'linter', 'linter_template',
|
||||
dirname( __DIR__ ) . '/sql/patch-linter-template_tag-fields.sql'
|
||||
);
|
||||
} elseif ( $dbType === 'sqlite' ) {
|
||||
$updater->addExtensionTable( 'linter',
|
||||
dirname( __DIR__ ) . '/sql/sqlite/tables-generated.sql'
|
||||
|
@ -51,6 +54,9 @@ class Hooks {
|
|||
$updater->addExtensionField( 'linter', 'linter_namespace',
|
||||
dirname( __DIR__ ) . '/sql/sqlite/patch-linter-add-namespace.sql'
|
||||
);
|
||||
$updater->addExtensionField( 'linter', 'linter_template',
|
||||
dirname( __DIR__ ) . '/sql/sqlite/patch-linter-template-tag-fields.sql'
|
||||
);
|
||||
} elseif ( $dbType === 'postgres' ) {
|
||||
$updater->addExtensionTable( 'linter',
|
||||
dirname( __DIR__ ) . '/sql/postgres/tables-generated.sql'
|
||||
|
@ -58,6 +64,9 @@ class Hooks {
|
|||
$updater->addExtensionField( 'linter', 'linter_namespace',
|
||||
dirname( __DIR__ ) . '/sql/postgres/patch-linter-add-namespace.sql'
|
||||
);
|
||||
$updater->addExtensionField( 'linter', 'linter_template',
|
||||
dirname( __DIR__ ) . '/sql/postgres/patch-linter-template-tag-fields.sql'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
{
|
||||
"comment": "Filter errors by details (T175177)",
|
||||
"before": {
|
||||
"name": "linter",
|
||||
"columns": [
|
||||
{
|
||||
"name": "linter_id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_page",
|
||||
"comment": "page id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_namespace",
|
||||
"comment": "page namespace",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false, "unsigned": false }
|
||||
},
|
||||
{
|
||||
"name": "linter_cat",
|
||||
"comment": "error category (see CategoryManager::$categoryIds)",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_start",
|
||||
"comment": "end positions of where the error is located",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_end",
|
||||
"comment": "end positions of where the error is located",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_params",
|
||||
"comment": "extra parameters about the error, JSON encoded",
|
||||
"type": "blob",
|
||||
"options": { "length": 65530, "notnull": false }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "linter_page",
|
||||
"comment": "Query by page",
|
||||
"columns": [ "linter_page" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_namespace",
|
||||
"comment": "Query by category and namespace",
|
||||
"columns": [ "linter_cat", "linter_namespace" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_page_position",
|
||||
"comment": "Unique index for lint errors, also covers linter_cat for query by category",
|
||||
"columns": [ "linter_cat", "linter_page", "linter_start", "linter_end" ],
|
||||
"unique": true
|
||||
}
|
||||
],
|
||||
"pk": [ "linter_id" ]
|
||||
},
|
||||
"after": {
|
||||
"name": "linter",
|
||||
"columns": [
|
||||
{
|
||||
"name": "linter_id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true, "autoincrement": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_page",
|
||||
"comment": "page id",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_namespace",
|
||||
"comment": "page namespace",
|
||||
"type": "integer",
|
||||
"options": { "notnull": false, "unsigned": false }
|
||||
},
|
||||
{
|
||||
"name": "linter_cat",
|
||||
"comment": "error category (see CategoryManager::$categoryIds)",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_start",
|
||||
"comment": "end positions of where the error is located",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_end",
|
||||
"comment": "end positions of where the error is located",
|
||||
"type": "integer",
|
||||
"options": { "notnull": true, "unsigned": true }
|
||||
},
|
||||
{
|
||||
"name": "linter_params",
|
||||
"comment": "extra parameters about the error, JSON encoded",
|
||||
"type": "blob",
|
||||
"options": { "length": 65530, "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "linter_template",
|
||||
"comment": "name of a template if used or empty",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 255, "default": "" }
|
||||
},
|
||||
{
|
||||
"name": "linter_tag",
|
||||
"comment": "name of tag if used or empty",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 32, "default": "" }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
{
|
||||
"name": "linter_page",
|
||||
"comment": "Query by page",
|
||||
"columns": [ "linter_page" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_namespace",
|
||||
"comment": "Query by category and namespace",
|
||||
"columns": [ "linter_cat", "linter_namespace" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_page_position",
|
||||
"comment": "Unique index for lint errors, also covers linter_cat for query by category",
|
||||
"columns": [ "linter_cat", "linter_page", "linter_start", "linter_end" ],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_template",
|
||||
"comment": "Query by template",
|
||||
"columns": [ "linter_cat", "linter_template" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_tag",
|
||||
"comment": "Query by tag",
|
||||
"columns": [ "linter_cat", "linter_tag" ],
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "linter_id" ]
|
||||
}
|
||||
}
|
9
sql/patch-linter-template-tag-fields.sql
Normal file
9
sql/patch-linter-template-tag-fields.sql
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: abstractSchemaChanges/patch-linter-add-template-tag-fields.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
ALTER TABLE /*_*/linter
|
||||
ADD linter_template VARBINARY(255) DEFAULT '' NOT NULL,
|
||||
ADD linter_tag VARBINARY(32) DEFAULT '' NOT NULL;
|
||||
CREATE INDEX linter_cat_template ON /*_*/linter (linter_cat, linter_template);
|
||||
CREATE INDEX linter_cat_tag ON /*_*/linter (linter_cat, linter_tag);
|
10
sql/postgres/patch-linter-template-tag-fields.sql
Normal file
10
sql/postgres/patch-linter-template-tag-fields.sql
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: abstractSchemaChanges/patch-linter-add-template-tag-fields.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
ALTER TABLE linter
|
||||
ADD linter_template TEXT DEFAULT '' NOT NULL;
|
||||
ALTER TABLE linter
|
||||
ADD linter_tag TEXT DEFAULT '' NOT NULL;
|
||||
CREATE INDEX linter_cat_template ON linter (linter_cat, linter_template);
|
||||
CREATE INDEX linter_cat_tag ON linter (linter_cat, linter_tag);
|
|
@ -10,6 +10,8 @@ CREATE TABLE linter (
|
|||
linter_start INT NOT NULL,
|
||||
linter_end INT NOT NULL,
|
||||
linter_params TEXT DEFAULT NULL,
|
||||
linter_template TEXT DEFAULT '' NOT NULL,
|
||||
linter_tag TEXT DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY(linter_id)
|
||||
);
|
||||
|
||||
|
@ -21,3 +23,7 @@ CREATE UNIQUE INDEX linter_cat_page_position ON linter (
|
|||
linter_cat, linter_page, linter_start,
|
||||
linter_end
|
||||
);
|
||||
|
||||
CREATE INDEX linter_cat_template ON linter (linter_cat, linter_template);
|
||||
|
||||
CREATE INDEX linter_cat_tag ON linter (linter_cat, linter_tag);
|
||||
|
|
21
sql/sqlite/patch-linter-template-tag-fields.sql
Normal file
21
sql/sqlite/patch-linter-template-tag-fields.sql
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
|
||||
-- Source: abstractSchemaChanges/patch-linter-add-template-tag-fields.json
|
||||
-- Do not modify this file directly.
|
||||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
|
||||
DROP INDEX linter_page;
|
||||
DROP INDEX linter_cat_namespace;
|
||||
DROP INDEX linter_cat_page_position;
|
||||
CREATE TEMPORARY TABLE /*_*/__temp__linter AS
|
||||
SELECT linter_id, linter_page, linter_namespace, linter_cat, linter_start, linter_end, linter_params
|
||||
FROM /*_*/linter;
|
||||
DROP TABLE /*_*/linter;
|
||||
CREATE TABLE /*_*/linter ( linter_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, linter_page INTEGER UNSIGNED NOT NULL, linter_namespace INTEGER DEFAULT NULL, linter_cat INTEGER UNSIGNED NOT NULL, linter_start INTEGER UNSIGNED NOT NULL, linter_end INTEGER UNSIGNED NOT NULL, linter_params BLOB DEFAULT NULL, linter_template BLOB DEFAULT '' NOT NULL, linter_tag BLOB DEFAULT '' NOT NULL );
|
||||
INSERT INTO /*_*/linter ( linter_id, linter_page, linter_namespace, linter_cat, linter_start, linter_end, linter_params )
|
||||
SELECT linter_id, linter_page, linter_namespace, linter_cat, linter_start, linter_end, linter_params
|
||||
FROM /*_*/__temp__linter;
|
||||
DROP TABLE /*_*/__temp__linter;
|
||||
CREATE INDEX linter_page ON /*_*/linter (linter_page);
|
||||
CREATE INDEX linter_cat_namespace ON /*_*/linter (linter_cat, linter_namespace);
|
||||
CREATE UNIQUE INDEX linter_cat_page_position ON /*_*/linter ( linter_cat, linter_page, linter_start, linter_end );
|
||||
CREATE INDEX linter_cat_template ON /*_*/linter (linter_cat, linter_template);
|
||||
CREATE INDEX linter_cat_tag ON /*_*/linter (linter_cat, linter_tag);
|
|
@ -9,7 +9,8 @@ CREATE TABLE /*_*/linter (
|
|||
linter_cat INTEGER UNSIGNED NOT NULL,
|
||||
linter_start INTEGER UNSIGNED NOT NULL,
|
||||
linter_end INTEGER UNSIGNED NOT NULL,
|
||||
linter_params BLOB DEFAULT NULL
|
||||
linter_params BLOB DEFAULT NULL, linter_template BLOB DEFAULT '' NOT NULL,
|
||||
linter_tag BLOB DEFAULT '' NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX linter_page ON /*_*/linter (linter_page);
|
||||
|
@ -20,3 +21,7 @@ CREATE UNIQUE INDEX linter_cat_page_position ON /*_*/linter (
|
|||
linter_cat, linter_page, linter_start,
|
||||
linter_end
|
||||
);
|
||||
|
||||
CREATE INDEX linter_cat_template ON /*_*/linter (linter_cat, linter_template);
|
||||
|
||||
CREATE INDEX linter_cat_tag ON /*_*/linter (linter_cat, linter_tag);
|
||||
|
|
|
@ -10,11 +10,15 @@ CREATE TABLE /*_*/linter (
|
|||
linter_start INT UNSIGNED NOT NULL,
|
||||
linter_end INT UNSIGNED NOT NULL,
|
||||
linter_params BLOB DEFAULT NULL,
|
||||
linter_template VARBINARY(255) DEFAULT '' NOT NULL,
|
||||
linter_tag VARBINARY(32) DEFAULT '' NOT NULL,
|
||||
INDEX linter_page (linter_page),
|
||||
INDEX linter_cat_namespace (linter_cat, linter_namespace),
|
||||
UNIQUE INDEX linter_cat_page_position (
|
||||
linter_cat, linter_page, linter_start,
|
||||
linter_end
|
||||
),
|
||||
INDEX linter_cat_template (linter_cat, linter_template),
|
||||
INDEX linter_cat_tag (linter_cat, linter_tag),
|
||||
PRIMARY KEY(linter_id)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
|
|
@ -42,6 +42,18 @@
|
|||
"comment": "extra parameters about the error, JSON encoded",
|
||||
"type": "blob",
|
||||
"options": { "length": 65530, "notnull": false }
|
||||
},
|
||||
{
|
||||
"name": "linter_template",
|
||||
"comment": "name of a template if used or empty",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 255, "default": "" }
|
||||
},
|
||||
{
|
||||
"name": "linter_tag",
|
||||
"comment": "name of tag if used or empty",
|
||||
"type": "binary",
|
||||
"options": { "notnull": true, "length": 32, "default": "" }
|
||||
}
|
||||
],
|
||||
"indexes": [
|
||||
|
@ -62,6 +74,18 @@
|
|||
"comment": "Unique index for lint errors, also covers linter_cat for query by category",
|
||||
"columns": [ "linter_cat", "linter_page", "linter_start", "linter_end" ],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_template",
|
||||
"comment": "Query by template",
|
||||
"columns": [ "linter_cat", "linter_template" ],
|
||||
"unique": false
|
||||
},
|
||||
{
|
||||
"name": "linter_cat_tag",
|
||||
"comment": "Query by tag",
|
||||
"columns": [ "linter_cat", "linter_tag" ],
|
||||
"unique": false
|
||||
}
|
||||
],
|
||||
"pk": [ "linter_id" ]
|
||||
|
|
Loading…
Reference in a new issue