migrations/Version20200317110027.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 Version20200317110027 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 measurements ADD started_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE measurements ADD finished_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE measurements ADD name TEXT DEFAULT NULL');
  22.         $this->addSql('ALTER TABLE measurements DROP is_finished');
  23.         $this->addSql('COMMENT ON COLUMN measurements.started_at IS \'When was this measurement marked as finished (device sent START flag).\'');
  24.         $this->addSql('COMMENT ON COLUMN measurements.finished_at IS \'When was this measurement marked as finished (device sent STOP flag).\'');
  25.         $this->addSql('COMMENT ON COLUMN measurements.name IS \'Name assigned to this measurement.\'');
  26.     }
  27.     public function down(Schema $schema) : void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  31.         $this->addSql('CREATE SCHEMA public');
  32.         $this->addSql('ALTER TABLE measurements ADD is_finished BOOLEAN DEFAULT \'false\' NOT NULL');
  33.         $this->addSql('ALTER TABLE measurements DROP started_at');
  34.         $this->addSql('ALTER TABLE measurements DROP finished_at');
  35.         $this->addSql('ALTER TABLE measurements DROP name');
  36.         $this->addSql('COMMENT ON COLUMN measurements.is_finished IS \'Was this measurement marked as finished.\'');
  37.     }
  38. }