From 9d9aa71eb736885f23c069a75c7a047b06434178 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 30 Aug 2018 15:41:16 +0200 Subject: Installation: Added migrations for install.sql and update.sql files --- .../2018_01_01_000001_import_install_sql.php | 59 ++++++++++++++++++++++ .../2018_01_01_000002_import_update_sql.php | 27 ++++++++++ 2 files changed, 86 insertions(+) create mode 100644 db/migrations/2018_01_01_000001_import_install_sql.php create mode 100644 db/migrations/2018_01_01_000002_import_update_sql.php (limited to 'db') diff --git a/db/migrations/2018_01_01_000001_import_install_sql.php b/db/migrations/2018_01_01_000001_import_install_sql.php new file mode 100644 index 00000000..bd7ec7ae --- /dev/null +++ b/db/migrations/2018_01_01_000001_import_install_sql.php @@ -0,0 +1,59 @@ +oldTables as $table) { + if ($this->schema->hasTable($table)) { + return; + } + } + + $sql = file_get_contents(__DIR__ . '/../install.sql'); + $this->schema->getConnection()->unprepared($sql); + } + + + /** + * Reverse the migration + */ + public + function down() + { + $this->schema->getConnection()->statement('SET FOREIGN_KEY_CHECKS=0;'); + + foreach ($this->oldTables as $table) { + if ($this->schema->hasTable($table)) { + $this->schema->dropIfExists($table); + } + } + } +} diff --git a/db/migrations/2018_01_01_000002_import_update_sql.php b/db/migrations/2018_01_01_000002_import_update_sql.php new file mode 100644 index 00000000..58687d6c --- /dev/null +++ b/db/migrations/2018_01_01_000002_import_update_sql.php @@ -0,0 +1,27 @@ +schema->hasTable('UserWorkLog')) { + return; + } + + $sql = file_get_contents(__DIR__ . '/../update.sql'); + $this->schema->getConnection()->unprepared($sql); + } + + /** + * Reverse the migration + */ + public function down() + { + $this->schema->dropIfExists('UserWorkLog'); + } +} -- cgit v1.2.3-54-g00ecf