<?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 Version20201103130531 extends AbstractMigration
{
public function getDescription(): string
{
return 'add tables: developer_rate, month, plan';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE developer_rate (id UUID NOT NULL, project_id UUID DEFAULT NULL, developer_id UUID DEFAULT NULL, inner_rate INT NOT NULL, outer_rate INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_823C427A166D1F9C ON developer_rate (project_id)');
$this->addSql('CREATE INDEX IDX_823C427A64DD9267 ON developer_rate (developer_id)');
$this->addSql('COMMENT ON COLUMN developer_rate.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN developer_rate.project_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN developer_rate.developer_id IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE month (id UUID NOT NULL, project_id UUID DEFAULT NULL, number INT NOT NULL, confirmed INT DEFAULT 0 NOT NULL, reminder INT DEFAULT 0 NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_8EB61006166D1F9C ON month (project_id)');
$this->addSql('COMMENT ON COLUMN month.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN month.project_id IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE plan (id UUID NOT NULL, month_id UUID DEFAULT NULL, developer_id UUID DEFAULT NULL, developer_rate_id UUID DEFAULT NULL, project_id UUID DEFAULT NULL, date_start DATE NOT NULL, date_end DATE NOT NULL, expected_incoming INT DEFAULT NULL, work_hours INT DEFAULT 0 NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_DD5A5B7DA0CBDE4 ON plan (month_id)');
$this->addSql('CREATE INDEX IDX_DD5A5B7D64DD9267 ON plan (developer_id)');
$this->addSql('CREATE INDEX IDX_DD5A5B7DD2077934 ON plan (developer_rate_id)');
$this->addSql('CREATE INDEX IDX_DD5A5B7D166D1F9C ON plan (project_id)');
$this->addSql('COMMENT ON COLUMN plan.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN plan.month_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN plan.developer_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN plan.developer_rate_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN plan.project_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN plan.date_start IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN plan.date_end IS \'(DC2Type:date_immutable)\'');
$this->addSql('ALTER TABLE developer_rate ADD CONSTRAINT FK_823C427A166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE developer_rate ADD CONSTRAINT FK_823C427A64DD9267 FOREIGN KEY (developer_id) REFERENCES developer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE month ADD CONSTRAINT FK_8EB61006166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plan ADD CONSTRAINT FK_DD5A5B7DA0CBDE4 FOREIGN KEY (month_id) REFERENCES month (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plan ADD CONSTRAINT FK_DD5A5B7D64DD9267 FOREIGN KEY (developer_id) REFERENCES developer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plan ADD CONSTRAINT FK_DD5A5B7DD2077934 FOREIGN KEY (developer_rate_id) REFERENCES developer_rate (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE plan ADD CONSTRAINT FK_DD5A5B7D166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE developers_rate');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE plan DROP CONSTRAINT FK_DD5A5B7DD2077934');
$this->addSql('ALTER TABLE plan DROP CONSTRAINT FK_DD5A5B7DA0CBDE4');
$this->addSql('CREATE TABLE developers_rate (id UUID NOT NULL, project_id UUID DEFAULT NULL, developer_id UUID DEFAULT NULL, inner_rate INT NOT NULL, outer_rate INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_1d2f4a3864dd9267 ON developers_rate (developer_id)');
$this->addSql('CREATE INDEX idx_1d2f4a38166d1f9c ON developers_rate (project_id)');
$this->addSql('COMMENT ON COLUMN developers_rate.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN developers_rate.project_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN developers_rate.developer_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE developers_rate ADD CONSTRAINT fk_1d2f4a38166d1f9c FOREIGN KEY (project_id) REFERENCES project (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE developers_rate ADD CONSTRAINT fk_1d2f4a3864dd9267 FOREIGN KEY (developer_id) REFERENCES developer (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE developer_rate');
$this->addSql('DROP TABLE month');
$this->addSql('DROP TABLE plan');
}
}