migrations/Version20210222071938.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 Version20210222071938 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add \'block_dates\' table';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('CREATE TABLE block_dates (id UUID NOT NULL, project_id UUID DEFAULT NULL, blocked_by_id UUID DEFAULT NULL, date_start DATE NOT NULL, date_end DATE NOT NULL, PRIMARY KEY(id))');
  18.         $this->addSql('CREATE INDEX IDX_6C650FF8166D1F9C ON block_dates (project_id)');
  19.         $this->addSql('CREATE INDEX IDX_6C650FF81DA661F8 ON block_dates (blocked_by_id)');
  20.         $this->addSql('COMMENT ON COLUMN block_dates.id IS \'(DC2Type:uuid)\'');
  21.         $this->addSql('COMMENT ON COLUMN block_dates.project_id IS \'(DC2Type:uuid)\'');
  22.         $this->addSql('COMMENT ON COLUMN block_dates.blocked_by_id IS \'(DC2Type:uuid)\'');
  23.         $this->addSql('ALTER TABLE block_dates ADD CONSTRAINT FK_6C650FF8166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.         $this->addSql('ALTER TABLE block_dates ADD CONSTRAINT FK_6C650FF81DA661F8 FOREIGN KEY (blocked_by_id) REFERENCES manager (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         $this->addSql('DROP TABLE block_dates');
  29.     }
  30. }