46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
use yii\db\Migration;
|
|
|
|
/**
|
|
* Handles the creation of table `{{%cms_menu_frontend}}`.
|
|
*/
|
|
class m260227_020845_create_cms_menu_frontend_table extends Migration
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function safeUp()
|
|
{
|
|
$this->createTable('{{%cms_menu_frontend}}', [
|
|
'id' => $this->primaryKey(),
|
|
'parent_id' => $this->integer()->defaultValue(null),
|
|
'name' => $this->string(255)->notNull(),
|
|
'link' => $this->string(255)->defaultValue(null),
|
|
'position' => $this->string(50)->notNull()->comment('navbar, left_menu'),
|
|
'sort_order' => $this->integer()->defaultValue(0),
|
|
'status' => $this->smallInteger(1)->defaultValue(1),
|
|
'created_at' => $this->integer(),
|
|
'updated_at' => $this->integer(),
|
|
]);
|
|
|
|
$this->addForeignKey(
|
|
'fk-cms_menu_frontend-parent_id',
|
|
'{{%cms_menu_frontend}}',
|
|
'parent_id',
|
|
'{{%cms_menu_frontend}}',
|
|
'id',
|
|
'CASCADE'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function safeDown()
|
|
{
|
|
$this->dropForeignKey('fk-cms_menu_frontend-parent_id', '{{%cms_menu_frontend}}');
|
|
$this->dropTable('{{%cms_menu_frontend}}');
|
|
}
|
|
}
|