<?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 Version20220310140313 extends AbstractMigration
{
public function getDescription(): string
{
return 'Card store ids';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE card_store (card_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', store_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_C763A9B14ACC9A20 (card_id), INDEX IDX_C763A9B1B092A811 (store_id), PRIMARY KEY(card_id, store_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE card_store ADD CONSTRAINT FK_C763A9B14ACC9A20 FOREIGN KEY (card_id) REFERENCES card (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE card_store ADD CONSTRAINT FK_C763A9B1B092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE card ADD stores_excluded TINYINT(1) NOT NULL AFTER drupal_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE card_store');
$this->addSql('ALTER TABLE card DROP stores_excluded');
}
public function isTransactional(): bool
{
return false;
}
}