createTable('{{%check}}', [ 'id' => $this->primaryKey(), 'number' => $this->string(255)->notNull(), 'company_id' => $this->integer(11)->notNull(), 'addresses_id' => $this->integer(11)->notNull(), 'status' => $this->integer(1)->defaultValue(1), ]); $this->createIndex('idx-check-company_id', 'check', 'company_id'); $this->addForeignKey( 'fk-check-company_id', 'check', 'company_id', 'company', 'id', 'CASCADE' ); $this->createIndex('idx-check-addresses_id', 'check', 'addresses_id'); $this->addForeignKey( 'fk-check-addresses_id', 'check', 'addresses_id', 'addresses', 'id', 'CASCADE' ); } /** * {@inheritdoc} */ public function safeDown() { $this->dropForeignKey( 'fk-check-company_id', 'check' ); // drops index for column `author_id` $this->dropIndex( 'idx-check-company_id', 'check' ); $this->dropForeignKey( 'fk-check-addresses_id', 'check' ); // drops index for column `author_id` $this->dropIndex( 'idx-check-addresses_id', 'check' ); $this->dropTable('{{%check}}'); } }