<?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 Version20200508062106 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('ALTER TABLE strength_point DROP CONSTRAINT fk_3f3a2707365144d3');
$this->addSql('DROP SEQUENCE strength_point_id_seq CASCADE');
$this->addSql('DROP SEQUENCE strength_point_setting_id_seq CASCADE');
$this->addSql('DROP TABLE strength_point_setting');
$this->addSql('DROP TABLE strength_point');
}
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('CREATE SEQUENCE strength_point_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE strength_point_setting_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE strength_point_setting (id INT NOT NULL, user_setting_id INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_6d735c7249527b9e ON strength_point_setting (user_setting_id)');
$this->addSql('CREATE TABLE strength_point (id INT NOT NULL, strength_points_settings_id INT DEFAULT NULL, value DOUBLE PRECISION NOT NULL, is_active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_3f3a2707365144d3 ON strength_point (strength_points_settings_id)');
$this->addSql('ALTER TABLE strength_point_setting ADD CONSTRAINT fk_6d735c7249527b9e FOREIGN KEY (user_setting_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE strength_point ADD CONSTRAINT fk_3f3a2707365144d3 FOREIGN KEY (strength_points_settings_id) REFERENCES strength_point_setting (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}