migrations/Version20180102143200.php line 1

  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * added columns parameters and parameters_structure to scenario table
  7.  */
  8. class Version20180102143200 extends AbstractMigration
  9. {
  10.     /**
  11.      * @param Schema $schema
  12.      */
  13.     public function up(Schema $schema) : void
  14.     {
  15.         // this up() migration is auto-generated, please modify it to your needs
  16.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  17.         $this->addSql('ALTER TABLE scenario ADD parameters BOOLEAN DEFAULT \'false\' NOT NULL');
  18.         $this->addSql('ALTER TABLE scenario ADD parameters_structure JSON DEFAULT NULL');
  19.         $this->addSql('COMMENT ON COLUMN scenario.parameters IS \'Will be parameters in this scenario?\'');
  20.         $this->addSql('COMMENT ON COLUMN scenario.parameters_structure IS \'Parameters of patient (json like {\'\'par_name1\'\':\'\'type1\'\', ...})\'');
  21.     }
  22.     /**
  23.      * @param Schema $schema
  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('ALTER TABLE scenario DROP parameters');
  31.         $this->addSql('ALTER TABLE scenario DROP parameters_structure');
  32.     }
  33. }