<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210222071938 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add \'block_dates\' table';
}
public function up(Schema $schema): void
{
$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))');
$this->addSql('CREATE INDEX IDX_6C650FF8166D1F9C ON block_dates (project_id)');
$this->addSql('CREATE INDEX IDX_6C650FF81DA661F8 ON block_dates (blocked_by_id)');
$this->addSql('COMMENT ON COLUMN block_dates.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN block_dates.project_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN block_dates.blocked_by_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE block_dates ADD CONSTRAINT FK_6C650FF8166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE block_dates ADD CONSTRAINT FK_6C650FF81DA661F8 FOREIGN KEY (blocked_by_id) REFERENCES manager (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE block_dates');
}
}