migrations/Version20200330102037.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 Version20200330102037 extends AbstractMigration
  10. {
  11.     /**
  12.      * @return string
  13.      */
  14.     public function getDescription(): string
  15.     {
  16.         return '';
  17.     }
  18.     /**
  19.      * @param Schema $schema
  20.      *
  21.      * @throws \Doctrine\DBAL\DBALException
  22.      */
  23.     public function up(Schema $schema): void
  24.     {
  25.         // this up() migration is auto-generated, please modify it to your needs
  26.         $this->abortIf(
  27.             $this->connection->getDatabasePlatform()->getName() !== 'postgresql',
  28.             'Migration can only be executed safely on \'postgresql\'.'
  29.         );
  30.         $this->addSql('ALTER TABLE devices ADD calibrated_at DATE DEFAULT NULL');
  31.     }
  32.     /**
  33.      * @param Schema $schema
  34.      *
  35.      * @throws \Doctrine\DBAL\DBALException
  36.      */
  37.     public function down(Schema $schema): void
  38.     {
  39.         // this down() migration is auto-generated, please modify it to your needs
  40.         $this->abortIf(
  41.             $this->connection->getDatabasePlatform()->getName() !== 'postgresql',
  42.             'Migration can only be executed safely on \'postgresql\'.'
  43.         );
  44.         $this->addSql('CREATE SCHEMA public');
  45.         $this->addSql('ALTER TABLE devices DROP calibrated_at');
  46.     }
  47. }