<?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 Version20220303100407 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE cal_workflow_status_date (id INT AUTO_INCREMENT NOT NULL, project_id INT DEFAULT NULL, status_id INT DEFAULT NULL, date DATETIME DEFAULT NULL, INDEX IDX_20C9A612166D1F9C (project_id), INDEX IDX_20C9A6126BF700BD (status_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cal_workflow_status_history (id INT AUTO_INCREMENT NOT NULL, project_id INT DEFAULT NULL, created_at DATETIME DEFAULT NULL, INDEX IDX_FC2B9555166D1F9C (project_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE cal_workflow_projects_statuses_history (workflow_status_history_id INT NOT NULL, workflow_status_id INT NOT NULL, INDEX IDX_4C0D979FC18216D2 (workflow_status_history_id), INDEX IDX_4C0D979F965E9A38 (workflow_status_id), PRIMARY KEY(workflow_status_history_id, workflow_status_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE cal_workflow_status_date ADD CONSTRAINT FK_20C9A612166D1F9C FOREIGN KEY (project_id) REFERENCES cal_workflow_project (id)');
$this->addSql('ALTER TABLE cal_workflow_status_date ADD CONSTRAINT FK_20C9A6126BF700BD FOREIGN KEY (status_id) REFERENCES cal_workflow_status (id)');
$this->addSql('ALTER TABLE cal_workflow_status_history ADD CONSTRAINT FK_FC2B9555166D1F9C FOREIGN KEY (project_id) REFERENCES cal_workflow_project (id)');
$this->addSql('ALTER TABLE cal_workflow_projects_statuses_history ADD CONSTRAINT FK_4C0D979FC18216D2 FOREIGN KEY (workflow_status_history_id) REFERENCES cal_workflow_status_history (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE cal_workflow_projects_statuses_history ADD CONSTRAINT FK_4C0D979F965E9A38 FOREIGN KEY (workflow_status_id) REFERENCES cal_workflow_status (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE cal_workflow_sort ADD status_list_id INT DEFAULT NULL, ADD status_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE cal_workflow_sort ADD CONSTRAINT FK_1322D6D6357E610E FOREIGN KEY (status_list_id) REFERENCES cal_workflow_table_list (id)');
$this->addSql('ALTER TABLE cal_workflow_sort ADD CONSTRAINT FK_1322D6D66BF700BD FOREIGN KEY (status_id) REFERENCES cal_workflow_status (id)');
$this->addSql('CREATE INDEX IDX_1322D6D6357E610E ON cal_workflow_sort (status_list_id)');
$this->addSql('CREATE INDEX IDX_1322D6D66BF700BD ON cal_workflow_sort (status_id)');
$this->addSql('ALTER TABLE cal_workflow_status ADD `default` TINYINT(1) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE cal_workflow_projects_statuses_history DROP FOREIGN KEY FK_4C0D979FC18216D2');
$this->addSql('DROP TABLE cal_workflow_status_date');
$this->addSql('DROP TABLE cal_workflow_status_history');
$this->addSql('DROP TABLE cal_workflow_projects_statuses_history');
$this->addSql('ALTER TABLE cal_workflow_sort DROP FOREIGN KEY FK_1322D6D6357E610E');
$this->addSql('ALTER TABLE cal_workflow_sort DROP FOREIGN KEY FK_1322D6D66BF700BD');
$this->addSql('DROP INDEX IDX_1322D6D6357E610E ON cal_workflow_sort');
$this->addSql('DROP INDEX IDX_1322D6D66BF700BD ON cal_workflow_sort');
$this->addSql('ALTER TABLE cal_workflow_sort DROP status_list_id, DROP status_id');
$this->addSql('ALTER TABLE cal_workflow_status DROP `default`');
}
}