migrations/Version20191110083406.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 Version20191110083406 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add calendar definition entity';
  14.     }
  15.     /**
  16.      * @throws \Doctrine\DBAL\DBALException
  17.      */
  18.     public function up(Schema $schema): void
  19.     {
  20.         // this up() migration is auto-generated, please modify it to your needs
  21.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  22.         $this->addSql('CREATE TABLE calendar (
  23.             id UUID NOT NULL, 
  24.             title VARCHAR(255) NOT NULL, 
  25.             description TEXT DEFAULT NULL, 
  26.             calendar_id VARCHAR(255) NOT NULL, 
  27.             public_url VARCHAR(255) DEFAULT NULL, 
  28.             i_cal_address VARCHAR(255) DEFAULT NULL, 
  29.             confirm_to TEXT DEFAULT NULL, PRIMARY KEY(id), 
  30.             slug VARCHAR(255) NOT NULL)'
  31.         );
  32.         $this->addSql('COMMENT ON COLUMN calendar.id IS \'(DC2Type:uuid)\'');
  33.         $this->addSql('COMMENT ON COLUMN calendar.confirm_to IS \'(DC2Type:simple_array)\'');
  34.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6EA9A1462B36786B ON calendar (title)');
  35.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6EA9A146A40A2C8 ON calendar (calendar_id)');
  36.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6EA9A146989D9B62 ON calendar (slug)');
  37.     }
  38.     /**
  39.      * @throws \Doctrine\DBAL\DBALException
  40.      */
  41.     public function down(Schema $schema): void
  42.     {
  43.         // this down() migration is auto-generated, please modify it to your needs
  44.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql''Migration can only be executed safely on \'postgresql\'.');
  45.         $this->addSql('DROP INDEX UNIQ_6EA9A1462B36786B');
  46.         $this->addSql('DROP INDEX UNIQ_6EA9A146A40A2C8');
  47.         $this->addSql('DROP INDEX UNIQ_6EA9A146989D9B62');
  48.         $this->addSql('DROP TABLE calendar');
  49.     }
  50. }