From 96aff80a2c334dda09bf6b0f716e25e96a31bdd4 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Thu, 19 Aug 2021 15:30:33 +0200 Subject: [PATCH] Added support for postgres db --- migrations/m180321_090927_add_translation_table.php | 3 ++- migrations/m180702_153622_add_translation_meta_table.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/migrations/m180321_090927_add_translation_table.php b/migrations/m180321_090927_add_translation_table.php index 83fc82f..0e2984b 100644 --- a/migrations/m180321_090927_add_translation_table.php +++ b/migrations/m180321_090927_add_translation_table.php @@ -12,6 +12,7 @@ class m180321_090927_add_translation_table extends Migration */ public function safeUp() { + $tableOptions = $this->db->getDriverName() === 'mysql' ? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci' : null; $this->createTable( 'dmstr_page_translation', @@ -25,7 +26,7 @@ public function safeUp() 'default_meta_description' => $this->text(), 'created_at' => $this->timestamp()->defaultExpression('NOW()'), 'updated_at' => $this->timestamp()->defaultExpression('NOW()'), - ],'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB' + ],$tableOptions ); $this->addForeignKey('FK_page_translation_page', 'dmstr_page_translation','page_id','dmstr_page','id'); diff --git a/migrations/m180702_153622_add_translation_meta_table.php b/migrations/m180702_153622_add_translation_meta_table.php index 31fb540..e99185a 100644 --- a/migrations/m180702_153622_add_translation_meta_table.php +++ b/migrations/m180702_153622_add_translation_meta_table.php @@ -12,6 +12,8 @@ class m180702_153622_add_translation_meta_table extends Migration */ public function safeUp() { + $tableOptions = $this->db->getDriverName() === 'mysql' ? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci' : null; + $this->createTable('{{%dmstr_page_translation_meta}}', [ 'id' => $this->primaryKey(), 'page_id' => $this->integer()->notNull(), @@ -20,7 +22,7 @@ public function safeUp() 'visible' => $this->smallInteger()->defaultValue(1), 'created_at' => $this->dateTime(), 'updated_at' => $this->dateTime(), - ], 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'); + ], $tableOptions); $this->addForeignKey( 'fk_page_page_translation_meta_id',