db->driverName === 'mysql') { $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%widget_text}}', [ 'id' => $this->primaryKey(), 'key' => $this->string()->notNull(), 'title' => $this->string()->notNull(), 'body' => $this->text()->notNull(), 'status' => $this->smallInteger(), 'created_at' => $this->integer(), 'updated_at' => $this->integer(), ], $tableOptions); $this->createIndex('idx_widget_text_key', '{{%widget_text}}', 'key'); } public function down() { $this->dropIndex('idx_widget_text_key', '{{%widget_text}}'); $this->dropTable('{{%widget_text}}'); } }