migrations/Version20220909072530.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 Version20220909072530 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE TABLE STAT_SCENARIO (SCENARIO_ID INT NOT NULL, STAT_ID INT NOT NULL, PRIMARY KEY(SCENARIO_ID, STAT_ID))');
$this->addSql('CREATE INDEX IDX_13CF990955009DD7 ON STAT_SCENARIO (SCENARIO_ID)');
$this->addSql('CREATE INDEX IDX_13CF9909E5897F1 ON STAT_SCENARIO (STAT_ID)');
$this->addSql('COMMENT ON COLUMN STAT_SCENARIO.SCENARIO_ID IS \'ID\'');
$this->addSql('COMMENT ON COLUMN STAT_SCENARIO.STAT_ID IS \'ID\'');
$this->addSql('CREATE TABLE stat (id INT NOT NULL, description TEXT DEFAULT NULL, date_from TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, date_to TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_36AC99F1460D9ASC ON stat (id)');
$this->addSql('COMMENT ON TABLE stat IS \'\'');
$this->addSql('COMMENT ON COLUMN stat.id IS \'ID\'');
$this->addSql('COMMENT ON COLUMN stat.description IS \'Description\'');
$this->addSql('CREATE TABLE STAT_USERS (USERS_ID INT NOT NULL, STAT_ID INT NOT NULL, PRIMARY KEY(USERS_ID, STAT_ID))');
$this->addSql('CREATE INDEX IDX_749760F699CD6E91 ON STAT_USERS (USERS_ID)');
$this->addSql('CREATE INDEX IDX_749760F6E5897F1 ON STAT_USERS (STAT_ID)');
$this->addSql('COMMENT ON COLUMN STAT_USERS.USERS_ID IS \'ID\'');
$this->addSql('COMMENT ON COLUMN STAT_USERS.STAT_ID IS \'ID\'');
$this->addSql('ALTER TABLE STAT_SCENARIO ADD CONSTRAINT FK_13CF990955009DD7 FOREIGN KEY (SCENARIO_ID) REFERENCES scenario (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE STAT_SCENARIO ADD CONSTRAINT FK_13CF9909E5897F1 FOREIGN KEY (STAT_ID) REFERENCES stat (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE STAT_USERS ADD CONSTRAINT FK_749760F699CD6E91 FOREIGN KEY (USERS_ID) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE STAT_USERS ADD CONSTRAINT FK_749760F6E5897F1 FOREIGN KEY (STAT_ID) REFERENCES stat (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE STAT_SCENARIO DROP CONSTRAINT FK_13CF9909E5897F1');
$this->addSql('ALTER TABLE STAT_USERS DROP CONSTRAINT FK_749760F6E5897F1');
$this->addSql('DROP TABLE STAT_SCENARIO');
$this->addSql('DROP TABLE stat');
$this->addSql('DROP TABLE STAT_USERS');
}
}