db = 'db'; parent::init(); } public function safeUp() { $tableOptions = 'ENGINE=InnoDB'; $this->createTable( '{{%report_photo}}', [ 'id'=> $this->primaryKey()->unsigned(), 'topic_id'=> $this->integer()->unsigned()->notNull()->defaultValue(0), 'title'=> $this->text()->null()->defaultValue(null), 'sort'=> $this->integer()->unsigned()->notNull()->defaultValue(0), 'active'=> $this->integer()->notNull()->defaultValue(0), ],$tableOptions ); $this->createIndex('sel','{{%report_photo}}',['id','topic_id','active'],false); $this->createIndex('sort','{{%report_photo}}',['sort'],false); } public function safeDown() { $this->dropIndex('sel', '{{%report_photo}}'); $this->dropIndex('sort', '{{%report_photo}}'); $this->dropTable('{{%report_photo}}'); } }