<?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 Version20220720135614 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 reservation_room (reservation_id INT NOT NULL, room_id INT NOT NULL, INDEX IDX_64A69CF3B83297E7 (reservation_id), INDEX IDX_64A69CF354177093 (room_id), PRIMARY KEY(reservation_id, room_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE reservation_room ADD CONSTRAINT FK_64A69CF3B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE reservation_room ADD CONSTRAINT FK_64A69CF354177093 FOREIGN KEY (room_id) REFERENCES room (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE reservation ADD member_id INT NOT NULL, ADD center_id INT NOT NULL, ADD number VARCHAR(255) NOT NULL, ADD arrival_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD departure_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD nbr_person NUMERIC(3, 0) NOT NULL');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C849557597D3FE FOREIGN KEY (member_id) REFERENCES member (id)');
$this->addSql('ALTER TABLE reservation ADD CONSTRAINT FK_42C849555932F377 FOREIGN KEY (center_id) REFERENCES center (id)');
$this->addSql('CREATE INDEX IDX_42C849557597D3FE ON reservation (member_id)');
$this->addSql('CREATE INDEX IDX_42C849555932F377 ON reservation (center_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE reservation_room');
$this->addSql('ALTER TABLE reservation DROP FOREIGN KEY FK_42C849557597D3FE');
$this->addSql('ALTER TABLE reservation DROP FOREIGN KEY FK_42C849555932F377');
$this->addSql('DROP INDEX IDX_42C849557597D3FE ON reservation');
$this->addSql('DROP INDEX IDX_42C849555932F377 ON reservation');
$this->addSql('ALTER TABLE reservation DROP member_id, DROP center_id, DROP number, DROP arrival_at, DROP departure_at, DROP created_at, DROP updated_at, DROP nbr_person');
}
}