createTable( 'wishlist', [ 'user_id' => $this->integer(), 'product_id' => $this->integer(), 'variant_id' => $this->integer(), ] ); $this->addForeignKey('user_fk', 'wishlist', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE'); $this->addForeignKey('product_fk', 'wishlist', 'product_id', 'product', 'id', 'CASCADE', 'CASCADE'); $this->addForeignKey('variant_fk', 'wishlist', 'variant_id', 'variant', 'id', 'CASCADE', 'CASCADE'); $this->createIndex( 'user_variant_fk', 'wishlist', [ 'user_id', 'variant_id', ], true ); } /** * @inheritdoc */ public function down() { $this->dropIndex( 'user_variant_fk', 'wishlist' ); $this->dropForeignKey('variant_fk', 'wishlist'); $this->dropForeignKey('product_fk', 'wishlist'); $this->dropForeignKey('user_fk', 'wishlist'); $this->dropTable('wishlist'); } }