Skip to content

Commit

Permalink
Merge pull request #45 from dmstr/feature/postgres-support
Browse files Browse the repository at this point in the history
Added support for postgres db
  • Loading branch information
schmunk42 authored Aug 19, 2021
2 parents 953f216 + 96aff80 commit c2a64de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion migrations/m180321_090927_add_translation_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
Expand Down
4 changes: 3 additions & 1 deletion migrations/m180702_153622_add_translation_meta_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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',
Expand Down

0 comments on commit c2a64de

Please sign in to comment.