<?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 Version20241114160729 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_4da239ecff285c');
        $this->addSql('DROP INDEX idx_4da239ecff285c');
        $this->addSql('ALTER TABLE reservations RENAME COLUMN table_id TO tables_id');
        $this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA23985405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('CREATE INDEX IDX_4DA23985405FD2 ON reservations (tables_id)');
        $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 tables_id');
        $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A37585405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('CREATE INDEX IDX_33C8A37585405FD2 ON statut_tables (tables_id)');
    }

    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('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A37585405FD2');
        $this->addSql('DROP INDEX IDX_33C8A37585405FD2');
        $this->addSql('ALTER TABLE statut_tables RENAME COLUMN tables_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('ALTER TABLE reservations DROP CONSTRAINT FK_4DA23985405FD2');
        $this->addSql('DROP INDEX IDX_4DA23985405FD2');
        $this->addSql('ALTER TABLE reservations RENAME COLUMN tables_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)');
    }
}
