FestinHegre/migrations/Version20241114160014.php

53 lines
2.7 KiB
PHP
Raw Permalink Normal View History

2024-11-21 15:45:32 +01:00
<?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 Version20241114160014 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('ALTER TABLE reservations DROP CONSTRAINT fk_4da2394de1870d');
$this->addSql('DROP INDEX idx_4da2394de1870d');
$this->addSql('ALTER TABLE reservations RENAME COLUMN tabl_id TO table_id');
$this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA239ECFF285C FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_4DA239ECFF285C ON reservations (table_id)');
$this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT fk_33c8a3754de1870d');
$this->addSql('DROP INDEX idx_33c8a3754de1870d');
$this->addSql('ALTER TABLE statut_tables RENAME COLUMN tabl_id TO table_id');
$this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A375ECFF285C FOREIGN KEY (table_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_33C8A375ECFF285C ON statut_tables (table_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_497B315E5126AC48 ON utilisateurs (mail)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP INDEX UNIQ_497B315E5126AC48');
$this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A375ECFF285C');
$this->addSql('DROP INDEX IDX_33C8A375ECFF285C');
$this->addSql('ALTER TABLE statut_tables RENAME COLUMN table_id TO tabl_id');
$this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT fk_33c8a3754de1870d FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_33c8a3754de1870d ON statut_tables (tabl_id)');
$this->addSql('ALTER TABLE reservations DROP CONSTRAINT FK_4DA239ECFF285C');
$this->addSql('DROP INDEX IDX_4DA239ECFF285C');
$this->addSql('ALTER TABLE reservations RENAME COLUMN table_id TO tabl_id');
$this->addSql('ALTER TABLE reservations ADD CONSTRAINT fk_4da2394de1870d FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_4da2394de1870d ON reservations (tabl_id)');
}
}