mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 22:51:04 +01:00
58 lines
2.7 KiB
PHP
58 lines
2.7 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 Version20221116134026 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 SEQUENCE building_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('CREATE SEQUENCE corridor_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('CREATE SEQUENCE floor_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('CREATE SEQUENCE place_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('CREATE SEQUENCE site_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
|
$this->addSql('CREATE TABLE building (id INT NOT NULL, site_id INT NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('CREATE INDEX IDX_E16F61D4F6BD1646 ON building (site_id)');
|
|
$this->addSql('CREATE TABLE corridor (id INT NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('CREATE TABLE floor (id INT NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('CREATE TABLE place (id INT NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('CREATE TABLE room (id INT NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('CREATE TABLE site (id INT NOT NULL, zero_latitude DOUBLE PRECISION NOT NULL, zero_longitude DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
|
|
$this->addSql('ALTER TABLE building ADD CONSTRAINT FK_E16F61D4F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) 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('DROP SEQUENCE building_id_seq CASCADE');
|
|
$this->addSql('DROP SEQUENCE corridor_id_seq CASCADE');
|
|
$this->addSql('DROP SEQUENCE floor_id_seq CASCADE');
|
|
$this->addSql('DROP SEQUENCE place_id_seq CASCADE');
|
|
$this->addSql('DROP SEQUENCE room_id_seq CASCADE');
|
|
$this->addSql('DROP SEQUENCE site_id_seq CASCADE');
|
|
$this->addSql('ALTER TABLE building DROP CONSTRAINT FK_E16F61D4F6BD1646');
|
|
$this->addSql('DROP TABLE building');
|
|
$this->addSql('DROP TABLE corridor');
|
|
$this->addSql('DROP TABLE floor');
|
|
$this->addSql('DROP TABLE place');
|
|
$this->addSql('DROP TABLE room');
|
|
$this->addSql('DROP TABLE site');
|
|
}
|
|
}
|