<?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 Version20260806215915 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 works_plan_stakeholders (works_plan_id INT NOT NULL, worker_activity_id INT NOT NULL, INDEX IDX_CA44D4732DA1180D (works_plan_id), INDEX IDX_CA44D47348487C51 (worker_activity_id), PRIMARY KEY(works_plan_id, worker_activity_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE works_plan_revisions (id INT AUTO_INCREMENT NOT NULL, works_plan_id INT NOT NULL, task_id INT DEFAULT NULL, requested_by_id INT DEFAULT NULL, reviewed_by_id INT DEFAULT NULL, revision_nr INT NOT NULL, description LONGTEXT DEFAULT NULL, review_note LONGTEXT DEFAULT NULL, original_data JSON DEFAULT NULL, revision_data JSON DEFAULT NULL, status ENUM(\'requested\', \'granted\', \'denied\', \'submitted\', \'approved\', \'rejected\', \'withdrawn\') NOT NULL, reviewed_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_C7F850182DA1180D (works_plan_id), INDEX IDX_C7F850188DB60186 (task_id), INDEX IDX_C7F850184DA1E751 (requested_by_id), INDEX IDX_C7F85018FC6B21F1 (reviewed_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE works_plan_stakeholders ADD CONSTRAINT FK_CA44D4732DA1180D FOREIGN KEY (works_plan_id) REFERENCES works_plan (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE works_plan_stakeholders ADD CONSTRAINT FK_CA44D47348487C51 FOREIGN KEY (worker_activity_id) REFERENCES worker_activities (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE works_plan_revisions ADD CONSTRAINT FK_C7F850182DA1180D FOREIGN KEY (works_plan_id) REFERENCES works_plan (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE works_plan_revisions ADD CONSTRAINT FK_C7F850188DB60186 FOREIGN KEY (task_id) REFERENCES works_plan_tasks (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE works_plan_revisions ADD CONSTRAINT FK_C7F850184DA1E751 FOREIGN KEY (requested_by_id) REFERENCES worker_activities (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE works_plan_revisions ADD CONSTRAINT FK_C7F85018FC6B21F1 FOREIGN KEY (reviewed_by_id) REFERENCES worker_activities (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role ENUM(\'intern\', \'extern\') DEFAULT NULL');
$this->addSql('ALTER TABLE calculation_permissions CHANGE type type ENUM(\'total\', \'average\', \'profit\', \'margin\', \'detail_report\') NOT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment CHANGE execution_scope execution_scope ENUM(\'internal\', \'external\') DEFAULT NULL, CHANGE execution_work_nature execution_work_nature ENUM(\'support\', \'production\') DEFAULT NULL');
$this->addSql('ALTER TABLE projects CHANGE type type ENUM(\'project\', \'daily_work\') DEFAULT \'project\'');
$this->addSql('ALTER TABLE purchase_request_histories CHANGE sender_mode sender_mode ENUM(\'approver\', \'requester\') DEFAULT NULL');
$this->addSql('ALTER TABLE purchase_request_status CHANGE status status ENUM(\'pending\', \'approved\', \'rejected\', \'delivered\') NOT NULL');
$this->addSql('ALTER TABLE stock_transactions CHANGE transaction_type transaction_type ENUM(\'in\', \'out\', \'move\') NOT NULL');
$this->addSql('ALTER TABLE todo_comments ADD translated_body LONGTEXT DEFAULT NULL, ADD translated_from VARCHAR(5) DEFAULT NULL');
$this->addSql('ALTER TABLE todo_notifications CHANGE status status ENUM(\'pending\', \'accepted\', \'in_process\', \'awaiting_confirmation\', \'completed\', \'rejected\') DEFAULT NULL, CHANGE type type ENUM(\'status\', \'comment\', \'new_todo\', \'case_closed\') DEFAULT \'status\' NOT NULL');
$this->addSql('ALTER TABLE todos ADD ai_estimate_hours DOUBLE PRECISION DEFAULT NULL, ADD ai_estimate_note LONGTEXT DEFAULT NULL, ADD ai_estimated_at DATETIME DEFAULT NULL, CHANGE priority priority ENUM(\'low\', \'medium\', \'high\', \'critical\') NOT NULL, CHANGE type type ENUM(\'bug\', \'improvement\', \'suggestion\') NOT NULL, CHANGE status status ENUM(\'pending\', \'accepted\', \'in_process\', \'awaiting_confirmation\', \'completed\', \'rejected\') NOT NULL, CHANGE ai_status ai_status ENUM(\'queued\', \'in_progress\', \'done\', \'failed\') DEFAULT NULL');
$this->addSql('ALTER TABLE vendor CHANGE vendor_type vendor_type ENUM(\'company\', \'freelancer\') DEFAULT NULL, CHANGE vendor_status vendor_status ENUM(\'active\', \'inactive\') DEFAULT NULL');
$this->addSql('DROP INDEX unique_personal_id ON worker');
$this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
$this->addSql('ALTER TABLE works_plan ADD lock_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', CHANGE owner_id owner_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE works_plan_jobs ADD start_fraction DOUBLE PRECISION DEFAULT \'1\' NOT NULL, ADD end_fraction DOUBLE PRECISION DEFAULT \'1\' NOT NULL');
$this->addSql('ALTER TABLE works_plan_tasks ADD owner_worker_activity_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE works_plan_tasks ADD CONSTRAINT FK_624FA6A9B8D933A0 FOREIGN KEY (owner_worker_activity_id) REFERENCES worker_activities (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_624FA6A9B8D933A0 ON works_plan_tasks (owner_worker_activity_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE works_plan_stakeholders DROP FOREIGN KEY FK_CA44D4732DA1180D');
$this->addSql('ALTER TABLE works_plan_stakeholders DROP FOREIGN KEY FK_CA44D47348487C51');
$this->addSql('ALTER TABLE works_plan_revisions DROP FOREIGN KEY FK_C7F850182DA1180D');
$this->addSql('ALTER TABLE works_plan_revisions DROP FOREIGN KEY FK_C7F850188DB60186');
$this->addSql('ALTER TABLE works_plan_revisions DROP FOREIGN KEY FK_C7F850184DA1E751');
$this->addSql('ALTER TABLE works_plan_revisions DROP FOREIGN KEY FK_C7F85018FC6B21F1');
$this->addSql('DROP TABLE works_plan_stakeholders');
$this->addSql('DROP TABLE works_plan_revisions');
$this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE calculation_permissions CHANGE type type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment CHANGE execution_scope execution_scope VARCHAR(255) DEFAULT NULL, CHANGE execution_work_nature execution_work_nature VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE projects CHANGE type type VARCHAR(255) DEFAULT \'project\'');
$this->addSql('ALTER TABLE purchase_request_histories CHANGE sender_mode sender_mode VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE purchase_request_status CHANGE status status VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE stock_transactions CHANGE transaction_type transaction_type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE todo_comments DROP translated_body, DROP translated_from');
$this->addSql('ALTER TABLE todo_notifications CHANGE type type VARCHAR(255) DEFAULT \'status\' NOT NULL, CHANGE status status VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE todos DROP ai_estimate_hours, DROP ai_estimate_note, DROP ai_estimated_at, CHANGE priority priority VARCHAR(255) NOT NULL, CHANGE type type VARCHAR(255) NOT NULL, CHANGE status status VARCHAR(255) NOT NULL, CHANGE ai_status ai_status VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE vendor CHANGE vendor_type vendor_type VARCHAR(255) DEFAULT NULL, CHANGE vendor_status vendor_status VARCHAR(255) DEFAULT NULL');
$this->addSql('DROP INDEX unique_personal_id ON worker');
$this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
$this->addSql('ALTER TABLE works_plan DROP lock_at, CHANGE owner_id owner_id INT NOT NULL');
$this->addSql('ALTER TABLE works_plan_jobs DROP start_fraction, DROP end_fraction');
$this->addSql('ALTER TABLE works_plan_tasks DROP FOREIGN KEY FK_624FA6A9B8D933A0');
$this->addSql('DROP INDEX IDX_624FA6A9B8D933A0 ON works_plan_tasks');
$this->addSql('ALTER TABLE works_plan_tasks DROP owner_worker_activity_id');
}
}