Beispiel #1
0
 public function dbInstall()
 {
     $db = Yii::$app->db;
     $tableOptions = null;
     if ($db->driverName === 'mysql') {
         $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=MyISAM';
     }
     $db->createCommand()->createTable(Menus::tableName(), ['menu_id' => 'pk', 'parent_id' => Schema::TYPE_INTEGER . ' NOT NULL DEFAULT 0', 'label' => Schema::TYPE_STRING . '(120) NOT NULL', 'url' => Schema::TYPE_STRING . '(255) DEFAULT NULL', 'type' => Schema::TYPE_STRING . '(15) NOT NULL', 'is_mobile' => 'tinyint(1) NOT NULL DEFAULT 1', 'order_num' => Schema::TYPE_INTEGER . ' DEFAULT NULL', 'status' => 'tinyint(1) NOT NULL DEFAULT 1', 'created_at' => Schema::TYPE_INTEGER . ' unsigned NOT NULL', 'updated_at' => Schema::TYPE_INTEGER . ' unsigned NOT NULL'], $tableOptions)->execute();
 }