From e3f7e6dc0b1dd57e448cf3df18f8d4095c85719d Mon Sep 17 00:00:00 2001 From: Egorka Date: Fri, 20 Jul 2018 08:14:18 +0300 Subject: [PATCH] Move pages migration to pages module --- .../m180720_051253_create_pages_table.php | 43 ++++++++++++++++++++++ .../m180107_210401_create_pages_table.php | 43 ---------------------- 2 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 common/modules/pages/migrations/m180720_051253_create_pages_table.php delete mode 100644 console/migrations/m180107_210401_create_pages_table.php diff --git a/common/modules/pages/migrations/m180720_051253_create_pages_table.php b/common/modules/pages/migrations/m180720_051253_create_pages_table.php new file mode 100644 index 0000000..30d04bc --- /dev/null +++ b/common/modules/pages/migrations/m180720_051253_create_pages_table.php @@ -0,0 +1,43 @@ +createTable('{{%pages}}', [ + 'id' => $this->primaryKey(), + 'title' => $this->string()->notNull(), + 'slug' => $this->string()->notNull(), + 'content' => 'MEDIUMTEXT', + 'meta_json' => $this->text()->notNull(), + 'lft' => $this->integer()->notNull(), + 'rgt' => $this->integer()->notNull(), + 'depth' => $this->integer()->notNull(), + ], $tableOptions); + + $this->createIndex('{{%idx-pages-slug}}', '{{%pages}}', 'slug', true); + + $this->insert('{{%pages}}', [ + 'id' => 1, + 'title' => '', + 'slug' => 'root', + 'content' => null, + 'meta_json' => '{}', + 'lft' => 1, + 'rgt' => 2, + 'depth' => 0, + ]); + } + + public function down() + { + $this->dropTable('{{%pages}}'); + } +} diff --git a/console/migrations/m180107_210401_create_pages_table.php b/console/migrations/m180107_210401_create_pages_table.php deleted file mode 100644 index 8b2a3c9..0000000 --- a/console/migrations/m180107_210401_create_pages_table.php +++ /dev/null @@ -1,43 +0,0 @@ -createTable('{{%pages}}', [ - 'id' => $this->primaryKey(), - 'title' => $this->string()->notNull(), - 'slug' => $this->string()->notNull(), - 'content' => 'MEDIUMTEXT', - 'meta_json' => $this->text()->notNull(), - 'lft' => $this->integer()->notNull(), - 'rgt' => $this->integer()->notNull(), - 'depth' => $this->integer()->notNull(), - ], $tableOptions); - - $this->createIndex('{{%idx-pages-slug}}', '{{%pages}}', 'slug', true); - - $this->insert('{{%pages}}', [ - 'id' => 1, - 'title' => '', - 'slug' => 'root', - 'content' => null, - 'meta_json' => '{}', - 'lft' => 1, - 'rgt' => 2, - 'depth' => 0, - ]); - } - - public function down() - { - $this->dropTable('{{%pages}}'); - } -}