migrations/Version20200508062106.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20200508062106 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  19.         $this->addSql('ALTER TABLE strength_point DROP CONSTRAINT fk_3f3a2707365144d3');
  20.         $this->addSql('DROP SEQUENCE strength_point_id_seq CASCADE');
  21.         $this->addSql('DROP SEQUENCE strength_point_setting_id_seq CASCADE');
  22.         $this->addSql('DROP TABLE strength_point_setting');
  23.         $this->addSql('DROP TABLE strength_point');
  24.     }
  25.     public function down(Schema $schema) : void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  29.         $this->addSql('CREATE SCHEMA public');
  30.         $this->addSql('CREATE SEQUENCE strength_point_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  31.         $this->addSql('CREATE SEQUENCE strength_point_setting_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  32.         $this->addSql('CREATE TABLE strength_point_setting (id INT NOT NULL, user_setting_id INT DEFAULT NULL, PRIMARY KEY(id))');
  33.         $this->addSql('CREATE INDEX idx_6d735c7249527b9e ON strength_point_setting (user_setting_id)');
  34.         $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))');
  35.         $this->addSql('CREATE INDEX idx_3f3a2707365144d3 ON strength_point (strength_points_settings_id)');
  36.         $this->addSql('ALTER TABLE strength_point_setting ADD CONSTRAINT fk_6d735c7249527b9e FOREIGN KEY (user_setting_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  37.         $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');
  38.     }
  39. }