db = 'db'; parent::init(); } public function safeUp() { $tableOptions = 'ENGINE=InnoDB'; $this->createTable( '{{%docs}}', [ 'id'=> $this->primaryKey()->unsigned(), 'title'=> $this->text()->notNull()->comment('Заголовок'), 'text'=> $this->text()->notNull()->comment('Описание'), 'cat'=> $this->string(128)->null()->defaultValue(null), 'uid'=> $this->string(128)->notNull(), ],$tableOptions ); $this->createIndex('uid','{{%docs}}',['uid'],false); $this->createIndex('cat','{{%docs}}',['cat'],false); } public function safeDown() { $this->dropIndex('uid', '{{%docs}}'); $this->dropIndex('cat', '{{%docs}}'); $this->dropTable('{{%docs}}'); } }