migrations/Version20230421003750.php line 1
<?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 Version20230421003750 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 area_reference (id INT NOT NULL, area TEXT NOT NULL, projection_system VARCHAR(64) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cycle_reference (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cycle_reference_phase_reference (cycle_reference_id INT NOT NULL, phase_reference_id INT NOT NULL, PRIMARY KEY(cycle_reference_id, phase_reference_id))');
$this->addSql('CREATE INDEX IDX_AB28D5F733025E65 ON cycle_reference_phase_reference (cycle_reference_id)');
$this->addSql('CREATE INDEX IDX_AB28D5F7F09AF490 ON cycle_reference_phase_reference (phase_reference_id)');
$this->addSql('CREATE TABLE period_reference (id INT NOT NULL, start_date_time TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, end_date_time TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE phase_reference (id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE phase_reference_phase_reference (phase_reference_source INT NOT NULL, phase_reference_target INT NOT NULL, PRIMARY KEY(phase_reference_source, phase_reference_target))');
$this->addSql('CREATE INDEX IDX_CE04C6BDB5DB24F7 ON phase_reference_phase_reference (phase_reference_source)');
$this->addSql('CREATE INDEX IDX_CE04C6BDAC3E7478 ON phase_reference_phase_reference (phase_reference_target)');
$this->addSql('ALTER TABLE area_reference ADD CONSTRAINT FK_3BDF0CCFBF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE cycle_reference ADD CONSTRAINT FK_7FFE4D63BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE cycle_reference_phase_reference ADD CONSTRAINT FK_AB28D5F733025E65 FOREIGN KEY (cycle_reference_id) REFERENCES cycle_reference (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE cycle_reference_phase_reference ADD CONSTRAINT FK_AB28D5F7F09AF490 FOREIGN KEY (phase_reference_id) REFERENCES phase_reference (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE period_reference ADD CONSTRAINT FK_7A7D32C1BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE phase_reference ADD CONSTRAINT FK_CF8CA289BF396750 FOREIGN KEY (id) REFERENCES primitive (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE phase_reference_phase_reference ADD CONSTRAINT FK_CE04C6BDB5DB24F7 FOREIGN KEY (phase_reference_source) REFERENCES phase_reference (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE phase_reference_phase_reference ADD CONSTRAINT FK_CE04C6BDAC3E7478 FOREIGN KEY (phase_reference_target) REFERENCES phase_reference (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 UNIQUE INDEX uniq_9bace7e1c74f2195 ON refresh_tokens (refresh_token)');
$this->addSql('ALTER TABLE area_reference DROP CONSTRAINT FK_3BDF0CCFBF396750');
$this->addSql('ALTER TABLE cycle_reference DROP CONSTRAINT FK_7FFE4D63BF396750');
$this->addSql('ALTER TABLE cycle_reference_phase_reference DROP CONSTRAINT FK_AB28D5F733025E65');
$this->addSql('ALTER TABLE cycle_reference_phase_reference DROP CONSTRAINT FK_AB28D5F7F09AF490');
$this->addSql('ALTER TABLE period_reference DROP CONSTRAINT FK_7A7D32C1BF396750');
$this->addSql('ALTER TABLE phase_reference DROP CONSTRAINT FK_CF8CA289BF396750');
$this->addSql('ALTER TABLE phase_reference_phase_reference DROP CONSTRAINT FK_CE04C6BDB5DB24F7');
$this->addSql('ALTER TABLE phase_reference_phase_reference DROP CONSTRAINT FK_CE04C6BDAC3E7478');
$this->addSql('DROP TABLE area_reference');
$this->addSql('DROP TABLE cycle_reference');
$this->addSql('DROP TABLE cycle_reference_phase_reference');
$this->addSql('DROP TABLE period_reference');
$this->addSql('DROP TABLE phase_reference');
$this->addSql('DROP TABLE phase_reference_phase_reference');
}
}