db = 'db'; parent::init(); } public function safeUp() { $tableOptions = 'ENGINE=InnoDB'; $this->createTable( '{{%report_topic}}', [ 'id'=> $this->primaryKey()->unsigned(), 'parent_id'=> $this->integer()->unsigned()->null()->defaultValue(0), 'date'=> $this->datetime()->notNull()->defaultExpression("CURRENT_TIMESTAMP"), 'title'=> $this->text()->null()->defaultValue(null), 'body'=> $this->text()->notNull(), 'folder'=> $this->string(250)->notNull()->defaultValue(''), 'sort'=> $this->integer()->notNull()->defaultValue(0), 'active'=> $this->integer()->notNull()->defaultValue(0), ],$tableOptions ); $this->createIndex('sel','{{%report_topic}}',['id','parent_id','active'],false); $this->createIndex('sort','{{%report_topic}}',['sort'],false); } public function safeDown() { $this->dropIndex('sel', '{{%report_topic}}'); $this->dropIndex('sort', '{{%report_topic}}'); $this->dropTable('{{%report_topic}}'); } }