for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use toir427\admin\components\Configs;
/**
* Migration table of table_menu
*
* @author Misbahul D Munir <[email protected]>
* @since 1.0
*/
class m140602_111327_create_menu_table extends \yii\db\Migration
{
* @inheritdoc
public function up()
$menuTable = Configs::instance()->menuTable;
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($menuTable, [
'id' => $this->primaryKey(),
'name' => $this->string(128)->notNull(),
'parent' => $this->integer(),
'route' => $this->string(),
'order' => $this->integer(),
'data' => $this->binary(),
"FOREIGN KEY ([[parent]]) REFERENCES {$menuTable}([[id]]) ON DELETE SET NULL ON UPDATE CASCADE",
], $tableOptions);
public function down()
$this->dropTable(Configs::instance()->menuTable);