<?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 Version20220730091327 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 visiting_card_open_hours (id INT AUTO_INCREMENT NOT NULL, open_hours_id INT DEFAULT NULL, visiting_card_id INT DEFAULT NULL, position DOUBLE PRECISION DEFAULT NULL, INDEX IDX_86E3013C77CF38C (open_hours_id), INDEX IDX_86E3013CEB37EBA0 (visiting_card_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE visiting_card_open_hours ADD CONSTRAINT FK_86E3013C77CF38C FOREIGN KEY (open_hours_id) REFERENCES open_hours (id)');
$this->addSql('ALTER TABLE visiting_card_open_hours ADD CONSTRAINT FK_86E3013CEB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id)');
$this->addSql('ALTER TABLE open_hours DROP FOREIGN KEY FK_C1A79D8BEB37EBA0');
$this->addSql('DROP INDEX IDX_C1A79D8BEB37EBA0 ON open_hours');
$this->addSql('ALTER TABLE open_hours DROP visiting_card_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE visiting_card_open_hours');
$this->addSql('ALTER TABLE open_hours ADD visiting_card_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE open_hours ADD CONSTRAINT FK_C1A79D8BEB37EBA0 FOREIGN KEY (visiting_card_id) REFERENCES visiting_card (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_C1A79D8BEB37EBA0 ON open_hours (visiting_card_id)');
}
}