db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ENGINE=InnoDB'; } $this->createTable('{{%menu_lng}}', [ 'id' => $this->primaryKey(), 'menu_id' => $this->integer()->notNull(), 'language' => $this->string(6)->notNull(), 'name' => $this->string(255)->notNull(), ], $tableOptions); $this->createIndex('idx_menu_lng_language', '{{%menu_lng}}', 'language'); $this->createIndex('idx_menu_lng_menu_id', '{{%menu_lng}}', 'menu_id'); $this->addForeignKey('frg_menu_lng_menu_menu_id_id', '{{%menu_lng}}', 'menu_id', '{{%menu}}', 'id', 'CASCADE', 'CASCADE'); } /** * {@inheritdoc} */ public function safeDown() { $this->dropForeignKey('frg_menu_lng_menu_menu_id_id', '{{%menu_lng}}'); $this->dropColumn('idx_menu_lng_menu_id', '{{%menu_lng}}'); $this->dropColumn('idx_menu_lng_language', '{{%menu_lng}}'); $this->dropTable('{{%menu_lng}}'); } }