Encartes-backend/migrations/Version20230110162444.php

41 lines
1.6 KiB
PHP

<?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 Version20230110162444 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('DROP SEQUENCE corridor_id_seq CASCADE');
$this->addSql('DROP SEQUENCE room_id_seq CASCADE');
$this->addSql('ALTER TABLE corridor ADD CONSTRAINT FK_D6DEE755BF396750 FOREIGN KEY (id) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE place ADD type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE room ADD CONSTRAINT FK_729F519BBF396750 FOREIGN KEY (id) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
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('CREATE SEQUENCE corridor_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE room_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('ALTER TABLE room DROP CONSTRAINT FK_729F519BBF396750');
$this->addSql('ALTER TABLE place DROP type');
$this->addSql('ALTER TABLE corridor DROP CONSTRAINT FK_D6DEE755BF396750');
}
}