71 lines
4.4 KiB
PHP
71 lines
4.4 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 Version20220926081328 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 niveau03_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||
|
$this->addSql('CREATE SEQUENCE niveau04_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||
|
$this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
|
||
|
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
|
||
|
$this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
|
||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
|
||
|
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
|
||
|
$this->addSql('ALTER TABLE niveau03 ADD CONSTRAINT FK_83F21F0F4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('ALTER TABLE niveau04 ADD CONSTRAINT FK_1D968AACF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('ALTER TABLE registration ADD niveau03_id INT DEFAULT NULL');
|
||
|
$this->addSql('ALTER TABLE registration ADD niveau04_id INT DEFAULT NULL');
|
||
|
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A7F3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A76E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('CREATE INDEX IDX_62A8A7A7F3F41F20 ON registration (niveau03_id)');
|
||
|
$this->addSql('CREATE INDEX IDX_62A8A7A76E232799 ON registration (niveau04_id)');
|
||
|
$this->addSql('ALTER TABLE useraccount ADD niveau03_id INT DEFAULT NULL');
|
||
|
$this->addSql('ALTER TABLE useraccount ADD niveau04_id INT DEFAULT NULL');
|
||
|
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1AF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A6E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
$this->addSql('CREATE INDEX IDX_E157AA1AF3F41F20 ON useraccount (niveau03_id)');
|
||
|
$this->addSql('CREATE INDEX IDX_E157AA1A6E232799 ON useraccount (niveau04_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 registration DROP CONSTRAINT FK_62A8A7A7F3F41F20');
|
||
|
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1AF3F41F20');
|
||
|
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A76E232799');
|
||
|
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A6E232799');
|
||
|
$this->addSql('DROP SEQUENCE niveau03_id_seq CASCADE');
|
||
|
$this->addSql('DROP SEQUENCE niveau04_id_seq CASCADE');
|
||
|
$this->addSql('ALTER TABLE niveau03 DROP CONSTRAINT FK_83F21F0F4B487845');
|
||
|
$this->addSql('ALTER TABLE niveau04 DROP CONSTRAINT FK_1D968AACF3F41F20');
|
||
|
$this->addSql('DROP TABLE niveau03');
|
||
|
$this->addSql('DROP TABLE niveau04');
|
||
|
$this->addSql('DROP INDEX IDX_E157AA1AF3F41F20');
|
||
|
$this->addSql('DROP INDEX IDX_E157AA1A6E232799');
|
||
|
$this->addSql('ALTER TABLE useraccount DROP niveau03_id');
|
||
|
$this->addSql('ALTER TABLE useraccount DROP niveau04_id');
|
||
|
$this->addSql('DROP INDEX IDX_62A8A7A7F3F41F20');
|
||
|
$this->addSql('DROP INDEX IDX_62A8A7A76E232799');
|
||
|
$this->addSql('ALTER TABLE registration DROP niveau03_id');
|
||
|
$this->addSql('ALTER TABLE registration DROP niveau04_id');
|
||
|
}
|
||
|
}
|