-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "tests: Add structure test for abstract schema"
- Loading branch information
Showing
27 changed files
with
174 additions
and
57 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
client/tests/phpunit/integration/includes/WikibaseClientSchemaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace Wikibase\Client\Tests\Integration; | ||
|
||
use MediaWiki\Tests\Structure\AbstractSchemaTestBase; | ||
|
||
/** | ||
* @group Wikibase | ||
* @coversNothing | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class WikibaseClientSchemaTest extends AbstractSchemaTestBase { | ||
protected static function getSchemasDirectory(): string { | ||
return __DIR__ . '/../../../sql/abstract/'; | ||
} | ||
|
||
protected static function getSchemaChangesDirectory(): string { | ||
return __DIR__ . '/../../../sql/abstractSchemaChanges/'; | ||
} | ||
|
||
protected static function getSchemaSQLDirs(): array { | ||
return [ | ||
'mysql' => __DIR__ . '/../../../sql/mysql/', | ||
'sqlite' => __DIR__ . '/../../../sql/sqlite', | ||
'postgres' => __DIR__ . '/../../../sql/postgres', | ||
]; | ||
} | ||
|
||
protected static function getSchemaChangesSQLDirs(): array { | ||
return [ | ||
'mysql' => __DIR__ . '/../../../sql/mysql/archives', | ||
'sqlite' => __DIR__ . '/../../../sql/sqlite/archives', | ||
'postgres' => __DIR__ . '/../../../sql/postgres/archives', | ||
]; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
repo/sql/mysql/archives/patch-wb_changes-change_object_id-index.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
CREATE INDEX change_object_id ON /*_*/wb_changes (change_object_id); | ||
CREATE INDEX change_object_id ON /*_*/wb_changes (change_object_id); |
8 changes: 4 additions & 4 deletions
8
repo/sql/mysql/archives/patch-wb_id_counters-unique-to-pk.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
DROP INDEX wb_id_counters_type ON /*_*/wb_id_counters; | ||
ALTER TABLE /*_*/wb_id_counters | ||
ADD PRIMARY KEY (id_type); | ||
DROP INDEX wb_id_counters_type ON /*_*/wb_id_counters; | ||
ALTER TABLE /*_*/wb_id_counters | ||
ADD PRIMARY KEY (id_type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
repo/sql/postgres/archives/patch-wb_changes-change_object_id-index.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
CREATE INDEX change_object_id ON wb_changes (change_object_id); | ||
CREATE INDEX change_object_id ON wb_changes (change_object_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
repo/sql/postgres/archives/patch-wb_id_counters-unique-to-pk.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
DROP INDEX wb_id_counters_type; | ||
ALTER TABLE wb_id_counters | ||
ADD PRIMARY KEY (id_type); | ||
DROP INDEX wb_id_counters_type; | ||
ALTER TABLE wb_id_counters | ||
ADD PRIMARY KEY (id_type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 44 additions & 14 deletions
58
repo/sql/sqlite/archives/patch-wb_changes-change_object_id-index.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,48 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_changes-change_object_id-index.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
DROP INDEX wb_changes_change_time; | ||
DROP INDEX wb_changes_change_revision_id; | ||
CREATE TEMPORARY TABLE /*_*/__temp__wb_changes AS | ||
SELECT change_id, change_type, change_time, change_object_id, change_revision_id, change_user_id, change_info | ||
FROM /*_*/wb_changes; | ||
DROP TABLE /*_*/wb_changes; | ||
CREATE TABLE /*_*/wb_changes ( change_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, change_type VARCHAR(25) NOT NULL, change_time BLOB NOT NULL, change_object_id BLOB NOT NULL, change_revision_id INTEGER UNSIGNED NOT NULL, change_user_id INTEGER UNSIGNED NOT NULL, change_info BLOB NOT NULL ); | ||
INSERT INTO /*_*/wb_changes ( change_id, change_type, change_time, change_object_id, change_revision_id, change_user_id, change_info ) | ||
SELECT change_id, change_type, change_time, change_object_id, change_revision_id, change_user_id, change_info | ||
FROM /*_*/__temp__wb_changes; | ||
DROP TABLE /*_*/__temp__wb_changes; | ||
CREATE INDEX wb_changes_change_time ON /*_*/wb_changes (change_time); | ||
CREATE INDEX wb_changes_change_revision_id ON /*_*/wb_changes (change_revision_id); | ||
CREATE INDEX change_object_id ON /*_*/wb_changes (change_object_id); | ||
SELECT | ||
change_id, | ||
change_type, | ||
change_time, | ||
change_object_id, | ||
change_revision_id, | ||
change_user_id, | ||
change_info | ||
FROM /*_*/wb_changes; | ||
DROP TABLE /*_*/wb_changes; | ||
|
||
|
||
CREATE TABLE /*_*/wb_changes ( | ||
change_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, | ||
change_type VARCHAR(25) NOT NULL, | ||
change_time BLOB NOT NULL, | ||
change_object_id BLOB NOT NULL, | ||
change_revision_id INTEGER UNSIGNED NOT NULL, | ||
change_user_id INTEGER UNSIGNED NOT NULL, | ||
change_info BLOB NOT NULL | ||
); | ||
INSERT INTO /*_*/wb_changes ( | ||
change_id, change_type, change_time, | ||
change_object_id, change_revision_id, | ||
change_user_id, change_info | ||
) | ||
SELECT | ||
change_id, | ||
change_type, | ||
change_time, | ||
change_object_id, | ||
change_revision_id, | ||
change_user_id, | ||
change_info | ||
FROM | ||
/*_*/__temp__wb_changes; | ||
DROP TABLE /*_*/__temp__wb_changes; | ||
|
||
CREATE INDEX wb_changes_change_time ON /*_*/wb_changes (change_time); | ||
|
||
CREATE INDEX wb_changes_change_revision_id ON /*_*/wb_changes (change_revision_id); | ||
|
||
CREATE INDEX change_object_id ON /*_*/wb_changes (change_object_id); |
29 changes: 20 additions & 9 deletions
29
repo/sql/sqlite/archives/patch-wb_id_counters-unique-to-pk.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
-- This file is automatically generated using maintenance/generateSchemaChangeSql.php. | ||
-- Source: extensions/Wikibase/repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Source: repo/sql/abstractSchemaChanges/patch-wb_id_counters-unique-to-pk.json | ||
-- Do not modify this file directly. | ||
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes | ||
CREATE TEMPORARY TABLE /*_*/__temp__wb_id_counters AS | ||
SELECT id_value, id_type | ||
FROM /*_*/wb_id_counters; | ||
DROP TABLE /*_*/wb_id_counters; | ||
CREATE TABLE /*_*/wb_id_counters ( id_type BLOB NOT NULL, id_value INTEGER UNSIGNED NOT NULL, PRIMARY KEY(id_type) ); | ||
INSERT INTO /*_*/wb_id_counters (id_value, id_type) | ||
SELECT id_value, id_type | ||
FROM /*_*/__temp__wb_id_counters; | ||
DROP TABLE /*_*/__temp__wb_id_counters; | ||
SELECT | ||
id_value, | ||
id_type | ||
FROM /*_*/wb_id_counters; | ||
DROP TABLE /*_*/wb_id_counters; | ||
|
||
|
||
CREATE TABLE /*_*/wb_id_counters ( | ||
id_type BLOB NOT NULL, | ||
id_value INTEGER UNSIGNED NOT NULL, | ||
PRIMARY KEY(id_type) | ||
); | ||
INSERT INTO /*_*/wb_id_counters (id_value, id_type) | ||
SELECT | ||
id_value, | ||
id_type | ||
FROM | ||
/*_*/__temp__wb_id_counters; | ||
DROP TABLE /*_*/__temp__wb_id_counters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace Wikibase\Repo\Tests; | ||
|
||
use MediaWiki\Tests\Structure\AbstractSchemaTestBase; | ||
|
||
/** | ||
* @group Wikibase | ||
* @coversNothing | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class WikibaseRepoSchemaTest extends AbstractSchemaTestBase { | ||
protected static function getSchemasDirectory(): string { | ||
return __DIR__ . '/../../../sql/abstract/'; | ||
} | ||
|
||
protected static function getSchemaChangesDirectory(): string { | ||
return __DIR__ . '/../../../sql/abstractSchemaChanges/'; | ||
} | ||
|
||
protected static function getSchemaSQLDirs(): array { | ||
return [ | ||
'mysql' => __DIR__ . '/../../../sql/mysql/', | ||
'sqlite' => __DIR__ . '/../../../sql/sqlite', | ||
'postgres' => __DIR__ . '/../../../sql/postgres', | ||
]; | ||
} | ||
|
||
protected static function getSchemaChangesSQLDirs(): array { | ||
return [ | ||
'mysql' => __DIR__ . '/../../../sql/mysql/archives', | ||
'sqlite' => __DIR__ . '/../../../sql/sqlite/archives', | ||
'postgres' => __DIR__ . '/../../../sql/postgres/archives', | ||
]; | ||
} | ||
} |