<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221109092633 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE cart (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, shop_id INT NOT NULL, INDEX IDX_BA388B79395C3F3 (customer_id), INDEX IDX_BA388B74D16C4DD (shop_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cart_frame (cart_id INT NOT NULL, frame_id INT NOT NULL, INDEX IDX_EA1251C51AD5CDBF (cart_id), INDEX IDX_EA1251C53FA3C347 (frame_id), PRIMARY KEY(cart_id, frame_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customer_frame (customer_id INT NOT NULL, frame_id INT NOT NULL, INDEX IDX_7BCD49F69395C3F3 (customer_id), INDEX IDX_7BCD49F63FA3C347 (frame_id), PRIMARY KEY(customer_id, frame_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cart ADD CONSTRAINT FK_BA388B79395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE cart ADD CONSTRAINT FK_BA388B74D16C4DD FOREIGN KEY (shop_id) REFERENCES shop (id)');
$this->addSql('ALTER TABLE cart_frame ADD CONSTRAINT FK_EA1251C51AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE cart_frame ADD CONSTRAINT FK_EA1251C53FA3C347 FOREIGN KEY (frame_id) REFERENCES frame (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE customer_frame ADD CONSTRAINT FK_7BCD49F69395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE customer_frame ADD CONSTRAINT FK_7BCD49F63FA3C347 FOREIGN KEY (frame_id) REFERENCES frame (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cart_frame DROP FOREIGN KEY FK_EA1251C51AD5CDBF');
$this->addSql('DROP TABLE cart');
$this->addSql('DROP TABLE cart_frame');
$this->addSql('DROP TABLE customer_frame');
}
}