migrations/Version20211014090916.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 Version20211014090916 extends AbstractMigration
{
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 SEQUENCE seq_scenario_timetrack_id INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE scenario_timetrack (id INT NOT NULL, users_id INT DEFAULT NULL, node_id INT NOT NULL, scenario_id INT NOT NULL, session_id VARCHAR(128) DEFAULT NULL, time TIME(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_BD1F5CE667B3B43D ON scenario_timetrack (users_id)');
$this->addSql('CREATE INDEX IDX_BD1F5CE6460D9FD7 ON scenario_timetrack (node_id)');
$this->addSql('CREATE INDEX IDX_BD1F5CE6E04E49DF ON scenario_timetrack (scenario_id)');
$this->addSql('COMMENT ON TABLE scenario_timetrack IS \'Table of the times spent on nodes of the scenarios.\'');
$this->addSql('COMMENT ON COLUMN scenario_timetrack.id IS \'ID\'');
$this->addSql('ALTER TABLE scenario_timetrack ADD CONSTRAINT FK_BD1F5CE667B3B43D FOREIGN KEY (users_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE scenario_timetrack ADD CONSTRAINT FK_BD1F5CE6460D9FD7 FOREIGN KEY (node_id) REFERENCES node (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE scenario_timetrack ADD CONSTRAINT FK_BD1F5CE6E04E49DF FOREIGN KEY (scenario_id) REFERENCES scenario (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('DROP SEQUENCE seq_scenario_timetrack_id CASCADE');
$this->addSql('DROP TABLE scenario_timetrack');
}
}