mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 22:51:04 +01:00
51 lines
2.6 KiB
PHP
51 lines
2.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 Version20221116143546 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 place_place (place_source INT NOT NULL, place_target INT NOT NULL, PRIMARY KEY(place_source, place_target))');
|
|
$this->addSql('CREATE INDEX IDX_DD6B48EEFD44781A ON place_place (place_source)');
|
|
$this->addSql('CREATE INDEX IDX_DD6B48EEE4A12895 ON place_place (place_target)');
|
|
$this->addSql('ALTER TABLE place_place ADD CONSTRAINT FK_DD6B48EEFD44781A FOREIGN KEY (place_source) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE place_place ADD CONSTRAINT FK_DD6B48EEE4A12895 FOREIGN KEY (place_target) REFERENCES place (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE corridor ADD floor_id INT NOT NULL');
|
|
$this->addSql('ALTER TABLE corridor ADD CONSTRAINT FK_D6DEE755854679E2 FOREIGN KEY (floor_id) REFERENCES floor (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('CREATE INDEX IDX_D6DEE755854679E2 ON corridor (floor_id)');
|
|
$this->addSql('ALTER TABLE floor ADD building_id INT NOT NULL');
|
|
$this->addSql('ALTER TABLE floor ADD CONSTRAINT FK_BE45D62E4D2A7E12 FOREIGN KEY (building_id) REFERENCES building (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('CREATE INDEX IDX_BE45D62E4D2A7E12 ON floor (building_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 place_place DROP CONSTRAINT FK_DD6B48EEFD44781A');
|
|
$this->addSql('ALTER TABLE place_place DROP CONSTRAINT FK_DD6B48EEE4A12895');
|
|
$this->addSql('DROP TABLE place_place');
|
|
$this->addSql('ALTER TABLE floor DROP CONSTRAINT FK_BE45D62E4D2A7E12');
|
|
$this->addSql('DROP INDEX IDX_BE45D62E4D2A7E12');
|
|
$this->addSql('ALTER TABLE floor DROP building_id');
|
|
$this->addSql('ALTER TABLE corridor DROP CONSTRAINT FK_D6DEE755854679E2');
|
|
$this->addSql('DROP INDEX IDX_D6DEE755854679E2');
|
|
$this->addSql('ALTER TABLE corridor DROP floor_id');
|
|
}
|
|
}
|