schema: Move all sql files to new sql folder

It is good practice to have a folder in the root for all sql files.
Also use the engine folder to store the patches and call the folder for
the json file "abstractSchemaChanges" as seen on other extensions

Change-Id: Iacf43b0e3c9027303ec81d535f2c61fc75a83a09
这个提交包含在:
Umherirrender 2022-06-10 21:44:38 +02:00
父节点 5f8a3670fa
当前提交 5fa729735e
共有 22 个文件被更改,包括 21 次插入21 次删除

查看文件

@ -20,19 +20,19 @@ class SchemaHooks implements LoadExtensionSchemaUpdatesHook, UnitTestsAfterDatab
. 'default cluster' );
}
$extensionRoot = __DIR__ . '/..';
$sqlDir = __DIR__ . '/../sql';
$engine = $updater->getDB()->getType();
$updater->addExtensionTable( 'growthexperiments_link_recommendations',
"$extensionRoot/maintenance/schemas/$engine/growthexperiments_link_recommendations.sql" );
"$sqlDir/$engine/growthexperiments_link_recommendations.sql" );
$updater->addExtensionTable( 'growthexperiments_link_submissions',
"$extensionRoot/maintenance/schemas/$engine/growthexperiments_link_submissions.sql" );
"$sqlDir/$engine/growthexperiments_link_submissions.sql" );
$updater->addExtensionTable( 'growthexperiments_mentee_data',
"$extensionRoot/maintenance/schemas/$engine/growthexperiments_mentee_data.sql" );
"$sqlDir/$engine/growthexperiments_mentee_data.sql" );
$updater->addExtensionTable( 'growthexperiments_mentor_mentee',
"$extensionRoot/maintenance/schemas/$engine/growthexperiments_mentor_mentee.sql" );
"$sqlDir/$engine/growthexperiments_mentor_mentee.sql" );
$updater->addExtensionField( 'growthexperiments_link_submissions',
'gels_anchor_offset',
"$extensionRoot/maintenance/schemaChanges/$engine/patch-add_gels_anchor.sql" );
"$sqlDir/$engine/patch-add_gels_anchor.sql" );
}
/** @inheritDoc */

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_recommendations.json
-- Source: GrowthExperiments/sql/growthexperiments_link_recommendations.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_link_recommendations (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_submissions.json
-- Source: GrowthExperiments/sql/growthexperiments_link_submissions.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_link_submissions (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentee_data.json
-- Source: sql/growthexperiments_mentee_data.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_mentee_data (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentor_mentee.json
-- Source: sql/growthexperiments_mentor_mentee.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_mentor_mentee (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_recommendations.json
-- Source: GrowthExperiments/sql/growthexperiments_link_recommendations.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE growthexperiments_link_recommendations (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_submissions.json
-- Source: GrowthExperiments/sql/growthexperiments_link_submissions.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE growthexperiments_link_submissions (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentee_data.json
-- Source: sql/growthexperiments_mentee_data.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE growthexperiments_mentee_data (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentor_mentee.json
-- Source: sql/growthexperiments_mentor_mentee.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE growthexperiments_mentor_mentee (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_recommendations.json
-- Source: GrowthExperiments/sql/growthexperiments_link_recommendations.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_link_recommendations (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: GrowthExperiments/maintenance/schemas/growthexperiments_link_submissions.json
-- Source: GrowthExperiments/sql/growthexperiments_link_submissions.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_link_submissions (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentee_data.json
-- Source: sql/growthexperiments_mentee_data.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_mentee_data (

查看文件

@ -1,5 +1,5 @@
-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/schemas/growthexperiments_mentor_mentee.json
-- Source: sql/growthexperiments_mentor_mentee.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/growthexperiments_mentor_mentee (

查看文件

@ -2,13 +2,13 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ENGINES='mysql sqlite postgres'
TABLES='growthexperiments_link_recommendations growthexperiments_link_submissions growthexperiments_mentee_data growthexperiments_mentor_mentee'
SCHEMA_CHANGES=`ls "$DIR"/schemaChanges/*.json | xargs -n1 basename`
SCHEMA_CHANGES=`ls "$DIR"/abstractSchemaChanges/*.json | xargs -n1 basename`
for engine in $ENGINES; do
for table in $TABLES; do
mwscript generateSchemaSql.php --json "$DIR/schemas/$table.json" --type $engine --sql "$DIR/schemas/$engine/$table.sql"
mwscript generateSchemaSql.php --json "$DIR/$table.json" --type $engine --sql "$DIR/$engine/$table.sql"
done
for change in $SCHEMA_CHANGES; do
mwscript generateSchemaChangeSql.php --json "$DIR/schemaChanges/$change" --type $engine --sql "$DIR/schemaChanges/$engine/${change%.json}.sql"
mwscript generateSchemaChangeSql.php --json "$DIR/abstractSchemaChanges/$change" --type $engine --sql "$DIR/$engine/${change%.json}.sql"
done
done