<?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 Version20221015082230 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 emplacement (id INT AUTO_INCREMENT NOT NULL, libelle VARCHAR(255) NOT NULL, adr VARCHAR(255) NOT NULL, cp VARCHAR(5) NOT NULL, ville VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE menu ADD emplacement_id INT NOT NULL, ADD debut_service TIME NOT NULL, ADD fin_service TIME NOT NULL');
$this->addSql('ALTER TABLE menu ADD CONSTRAINT FK_7D053A93C4598A51 FOREIGN KEY (emplacement_id) REFERENCES emplacement (id)');
$this->addSql('CREATE INDEX IDX_7D053A93C4598A51 ON menu (emplacement_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE menu DROP FOREIGN KEY FK_7D053A93C4598A51');
$this->addSql('DROP TABLE emplacement');
$this->addSql('DROP INDEX IDX_7D053A93C4598A51 ON menu');
$this->addSql('ALTER TABLE menu DROP emplacement_id, DROP debut_service, DROP fin_service');
}
}