feat(backend) : add migration for isFinal, archived fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-12 17:58:20 +01:00
parent e98d952871
commit 2c2ca0a8b6
2 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?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 Version20260312111449 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('ALTER TABLE project ADD code VARCHAR(10) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2FB3D0EE77153098 ON project (code)');
$this->addSql('ALTER TABLE task ADD number INT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_2FB3D0EE77153098');
$this->addSql('ALTER TABLE project DROP code');
$this->addSql('ALTER TABLE task DROP number');
}
}

View File

@@ -0,0 +1,51 @@
<?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 Version20260312165317 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('ALTER TABLE task ADD archived BOOLEAN NOT NULL DEFAULT FALSE');
$this->addSql('ALTER TABLE task_task_type DROP CONSTRAINT fk_80470e038db60186');
$this->addSql('ALTER TABLE task_task_type DROP CONSTRAINT fk_80470e03daada679');
$this->addSql('ALTER TABLE task_task_type ADD CONSTRAINT FK_80470E038DB60186 FOREIGN KEY (task_id) REFERENCES task (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE task_task_type ADD CONSTRAINT FK_80470E03DAADA679 FOREIGN KEY (task_type_id) REFERENCES task_type (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE task_group ADD archived BOOLEAN NOT NULL DEFAULT FALSE');
$this->addSql('ALTER TABLE task_status ADD is_final BOOLEAN NOT NULL DEFAULT FALSE');
$this->addSql('ALTER TABLE time_entry_task_type DROP CONSTRAINT fk_be7a719d1eb30a8e');
$this->addSql('ALTER TABLE time_entry_task_type DROP CONSTRAINT fk_be7a719ddaada679');
$this->addSql('ALTER TABLE time_entry_task_type ADD CONSTRAINT FK_BE7A719D1EB30A8E FOREIGN KEY (time_entry_id) REFERENCES time_entry (id) NOT DEFERRABLE');
$this->addSql('ALTER TABLE time_entry_task_type ADD CONSTRAINT FK_BE7A719DDAADA679 FOREIGN KEY (task_type_id) REFERENCES task_type (id) NOT DEFERRABLE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE task DROP archived');
$this->addSql('ALTER TABLE task_group DROP archived');
$this->addSql('ALTER TABLE task_status DROP is_final');
$this->addSql('ALTER TABLE task_task_type DROP CONSTRAINT FK_80470E038DB60186');
$this->addSql('ALTER TABLE task_task_type DROP CONSTRAINT FK_80470E03DAADA679');
$this->addSql('ALTER TABLE task_task_type ADD CONSTRAINT fk_80470e038db60186 FOREIGN KEY (task_id) REFERENCES task (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE task_task_type ADD CONSTRAINT fk_80470e03daada679 FOREIGN KEY (task_type_id) REFERENCES task_type (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE time_entry_task_type DROP CONSTRAINT FK_BE7A719D1EB30A8E');
$this->addSql('ALTER TABLE time_entry_task_type DROP CONSTRAINT FK_BE7A719DDAADA679');
$this->addSql('ALTER TABLE time_entry_task_type ADD CONSTRAINT fk_be7a719d1eb30a8e FOREIGN KEY (time_entry_id) REFERENCES time_entry (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE time_entry_task_type ADD CONSTRAINT fk_be7a719ddaada679 FOREIGN KEY (task_type_id) REFERENCES task_type (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}