<?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 Version20220125162714 extends AbstractMigration
{
public function getDescription(): string
{
return 'store relations: delivery_method, delivery_method.payment_method, open times and settings';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE store_delivery_method DROP FOREIGN KEY FK_2134AA20B092A811');
$this->addSql('ALTER TABLE store_delivery_method ADD CONSTRAINT FK_2134AA20B092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE store_open_time DROP FOREIGN KEY FK_8B36B51DB092A811');
$this->addSql('ALTER TABLE store_open_time ADD CONSTRAINT FK_8B36B51DB092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE store_payment_method DROP FOREIGN KEY FK_6CF7BC285DED75F5');
$this->addSql('ALTER TABLE store_payment_method CHANGE delivery_method_id delivery_method_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE store_payment_method ADD CONSTRAINT FK_6CF7BC285DED75F5 FOREIGN KEY (delivery_method_id) REFERENCES store_delivery_method (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE store_settings DROP FOREIGN KEY FK_DB32DF3FB092A811');
$this->addSql('ALTER TABLE store_settings ADD CONSTRAINT FK_DB32DF3FB092A811 FOREIGN KEY (store_id) REFERENCES store (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 store_delivery_method DROP FOREIGN KEY FK_2134AA20B092A811');
$this->addSql('ALTER TABLE store_delivery_method ADD CONSTRAINT FK_2134AA20B092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE store_open_time DROP FOREIGN KEY FK_8B36B51DB092A811');
$this->addSql('ALTER TABLE store_open_time ADD CONSTRAINT FK_8B36B51DB092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE store_payment_method DROP FOREIGN KEY FK_6CF7BC285DED75F5');
$this->addSql('ALTER TABLE store_payment_method CHANGE delivery_method_id delivery_method_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE store_payment_method ADD CONSTRAINT FK_6CF7BC285DED75F5 FOREIGN KEY (delivery_method_id) REFERENCES store_delivery_method (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE store_settings DROP FOREIGN KEY FK_DB32DF3FB092A811');
$this->addSql('ALTER TABLE store_settings ADD CONSTRAINT FK_DB32DF3FB092A811 FOREIGN KEY (store_id) REFERENCES store (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
}
public function isTransactional(): bool
{
return false;
}
}