createTable('{{%order}}', [ 'id' => $this->primaryKey(), 'user_id' => $this->integer(), 'table_id' => $this->integer(), 'strength' => $this->tinyInteger(), 'amount' => $this->float(), 'status' => $this->tinyInteger(), 'created_at' => $this->timestamp(), 'updated_at' => $this->timestamp(), ]); $this->createIndex( 'idx-order-user_id', 'order', 'user_id' ); $this->addForeignKey( 'fk-order-user_id', 'order', 'user_id', 'user', 'id', 'CASCADE' ); $this->createIndex( 'idx-order-table_id', 'order', 'table_id' ); $this->addForeignKey( 'fk-order-table_id', 'order', 'table_id', 'table', 'id', 'CASCADE' ); } /** * {@inheritdoc} */ public function safeDown() { $this->dropForeignKey('fk-order-user_id', 'order'); $this->dropIndex('idx-order-user_id', 'order'); $this->dropForeignKey('fk-order-table_id', 'order'); $this->dropIndex('idx-order-table_id', 'order'); $this->dropTable('{{%order}}'); } }