From 8df9aa073ad6dc4a9cbba922900c5fe1f7d4acad Mon Sep 17 00:00:00 2001 From: Alfred Egger Date: Mon, 2 Nov 2020 01:03:05 +0100 Subject: [PATCH] Convert from database.xml to new migrations --- appinfo/database.xml | 55 ------------- .../Version010703Date20201101235744.php | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 55 deletions(-) delete mode 100644 appinfo/database.xml create mode 100644 lib/Migration/Version010703Date20201101235744.php diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index 33c2458..0000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - *dbname* - true - false - utf8 - - *dbprefix*weather_city - - - id - integer - true - 10 - 1 - true - - - name - text - true - 255 - - - user_id - text - true - 255 - - -
- - *dbprefix*weather_config - - - user - text - true - 255 - - - key - text - true - 255 - - - value - text - false - 10240 - - -
-
diff --git a/lib/Migration/Version010703Date20201101235744.php b/lib/Migration/Version010703Date20201101235744.php new file mode 100644 index 0000000..d225ed4 --- /dev/null +++ b/lib/Migration/Version010703Date20201101235744.php @@ -0,0 +1,78 @@ +hasTable('weather_city')) { + $table = $schema->createTable('weather_city'); + $table->addColumn('id', 'bigint', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 10, + ]); + $table->addColumn('name', 'string', [ + 'notnull' => true, + 'length' => 255, + ]); + $table->addColumn('user_id', 'string', [ + 'notnull' => true, + 'length' => 255, + ]); + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('weather_config')) { + $table = $schema->createTable('weather_config'); + $table->addColumn('user', 'string', [ + 'notnull' => true, + 'length' => 255, + ]); + $table->addColumn('key', 'string', [ + 'notnull' => true, + 'length' => 255, + ]); + $table->addColumn('value', 'string', [ + 'notnull' => false, + 'length' => 10240, + ]); + } + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + } +}