<?php
declare(strict_types=1);
namespace Boldr\Cms\OpeningHoursBundle\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Boldr\Cms\CmsBundle\BoldrCmsMigration;
class Version0_Install extends BoldrCmsMigration
{
public function getBundle(): string { return 'boldr/opening-hours-bundle'; }
public function getVersion(): ?string { return null; }
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE opening_hours_holiday (id INT UNSIGNED AUTO_INCREMENT NOT NULL, set_id INT UNSIGNED NOT NULL, date_start DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_end DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', INDEX IDX_DE0B0BE810FB0D18 (set_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE opening_hours_opening_hours (id INT UNSIGNED AUTO_INCREMENT NOT NULL, set_id INT UNSIGNED NOT NULL, day_of_the_week INT NOT NULL, time_start INT NOT NULL, time_end INT NOT NULL, preparation_time INT NOT NULL, INDEX IDX_5813259510FB0D18 (set_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE opening_hours_set (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE opening_hours_holiday ADD CONSTRAINT FK_DE0B0BE810FB0D18 FOREIGN KEY (set_id) REFERENCES opening_hours_set (id)');
$this->addSql('ALTER TABLE opening_hours_opening_hours ADD CONSTRAINT FK_5813259510FB0D18 FOREIGN KEY (set_id) REFERENCES opening_hours_set (id)');
}
}