db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%settings_lng}}', [ 'id' => $this->primaryKey(), 'language' => $this->string(6)->notNull(), 'section' => $this->string(255)->notNull(), 'key' => $this->string(255)->notNull(), 'value' => $this->text(), ], $tableOptions); $this->createIndex('key', '{{%settings_lng}}', ['section', 'key']); $this->createIndex('idx_settings_lng_language', '{{%settings_lng}}', 'language'); $this->addForeignKey('frg_settings_lng_settings_setting_id_id', '{{%settings_lng}}', ['section', 'key'], '{{%settings}}', ['section', 'key'], 'CASCADE', 'CASCADE'); $this->dropColumn('{{%settings}}', 'id'); $this->addPrimaryKey('key', '{{%settings}}', ['section', 'key']); $this->dropColumn('{{%settings}}', 'value'); } /** * {@inheritdoc} */ public function safeDown() { $this->addColumn('{{%settings}}', 'value', $this->text()); $this->dropPrimaryKey('key', '{{%settings}}'); $this->addColumn('{{%settings}}', 'id', $this->primaryKey()); $this->dropForeignKey('frg_settings_lng_settings_setting_id_id', '{{%settings_lng}}'); $this->dropIndex('idx_settings_lng_language', '{{%settings_lng}}'); $this->dropTable('{{%settings_lng}}'); } }