<?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 Version20260930200642 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 partner_qualification_rate (id INT AUTO_INCREMENT NOT NULL, partner_id INT NOT NULL, qualification_id INT NOT NULL, hourly_rate DOUBLE PRECISION DEFAULT NULL, updated_at DATETIME DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, INDEX IDX_666533BA9393F8FE (partner_id), INDEX IDX_666533BA1A75EE38 (qualification_id), UNIQUE INDEX UNIQ_pqr_partner_qualification (partner_id, qualification_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE worker_absence_documents (id INT AUTO_INCREMENT NOT NULL, absence_id INT NOT NULL, kind ENUM(\'sick_note\', \'signed_leave_request\', \'other\') NOT NULL, original_name VARCHAR(255) NOT NULL, stored_name VARCHAR(100) NOT NULL, mime_type VARCHAR(100) DEFAULT NULL, size INT DEFAULT NULL, uploaded_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', uploaded_by VARCHAR(180) DEFAULT NULL, INDEX IDX_5801A9E2DFF238F (absence_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE worker_absences (id INT AUTO_INCREMENT NOT NULL, worker_id INT NOT NULL, type ENUM(\'H\', \'S\', \'HNP\') NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', note LONGTEXT DEFAULT NULL, applied_days JSON DEFAULT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by VARCHAR(180) DEFAULT NULL, updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_by VARCHAR(180) DEFAULT NULL, INDEX IDX_F1993DA96B20BA36 (worker_id), INDEX idx_worker_absence_range (worker_id, date_from, date_to), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE partner_qualification_rate ADD CONSTRAINT FK_666533BA9393F8FE FOREIGN KEY (partner_id) REFERENCES partner (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE partner_qualification_rate ADD CONSTRAINT FK_666533BA1A75EE38 FOREIGN KEY (qualification_id) REFERENCES qualification (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE worker_absence_documents ADD CONSTRAINT FK_5801A9E2DFF238F FOREIGN KEY (absence_id) REFERENCES worker_absences (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE worker_absences ADD CONSTRAINT FK_F1993DA96B20BA36 FOREIGN KEY (worker_id) REFERENCES worker (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role ENUM(\'intern\', \'extern\') DEFAULT NULL');
$this->addSql('ALTER TABLE ai_hub_features CHANGE feature_key feature_key ENUM(\'web_search\', \'web_fetch\', \'file_create\', \'file_attach\', \'voice_input\', \'voice_mode\', \'cowork_mode\', \'model_picker\', \'groups\', \'search\') NOT NULL, CHANGE state state ENUM(\'on\', \'disabled\', \'hidden\') NOT NULL, CHANGE reason reason ENUM(\'coming_soon\', \'maintenance\', \'admin_off\') DEFAULT NULL');
$this->addSql('ALTER TABLE calculation_permissions CHANGE type type ENUM(\'total\', \'average\', \'profit\', \'margin\', \'detail_report\') NOT NULL');
$this->addSql('ALTER TABLE desktop_settings CHANGE default_language default_language ENUM(\'de\', \'en\', \'tr\') DEFAULT NULL, CHANGE social_insurance_country social_insurance_country ENUM(\'DE\', \'FR\', \'GENERIC\') DEFAULT NULL');
$this->addSql('ALTER TABLE material_request CHANGE status status ENUM(\'draft\', \'submitted\', \'ordered\', \'partially_ordered\', \'rejected\') DEFAULT \'draft\' NOT NULL');
$this->addSql('ALTER TABLE material_request_documents CHANGE status status ENUM(\'pending\', \'ordered\', \'partially_ordered\', \'rejected\') DEFAULT \'pending\' 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\', \'service\', \'production\') DEFAULT NULL, CHANGE status status ENUM(\'draft\', \'published\') DEFAULT \'draft\' NOT NULL, CHANGE decline_reason_category decline_reason_category ENUM(\'supply\', \'personnel\', \'weather\', \'scope_change\', \'other\') DEFAULT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment_date_revisions CHANGE reason_category reason_category ENUM(\'supply\', \'personnel\', \'weather\', \'scope_change\', \'other\') DEFAULT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment_messages CHANGE sender_side sender_side ENUM(\'owner\', \'executor\') NOT 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 task_fulfillment_stage_history CHANGE changed_by_scope changed_by_scope ENUM(\'internal\', \'external\') DEFAULT NULL, CHANGE source source ENUM(\'service\', \'erp\', \'system\') NOT NULL');
$this->addSql('ALTER TABLE task_fulfillment_stages CHANGE work_nature work_nature ENUM(\'support\', \'service\', \'production\') 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 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 \'active\' NOT NULL');
$this->addSql('DROP INDEX unique_personal_id ON worker');
$this->addSql('ALTER TABLE worker ADD default_qualification_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE worker ADD CONSTRAINT FK_9FB2BF629588266F FOREIGN KEY (default_qualification_id) REFERENCES qualification (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_9FB2BF629588266F ON worker (default_qualification_id)');
$this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
$this->addSql('ALTER TABLE works_plan_revisions CHANGE status status ENUM(\'requested\', \'granted\', \'denied\', \'submitted\', \'approved\', \'rejected\', \'withdrawn\') NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE partner_qualification_rate DROP FOREIGN KEY FK_666533BA9393F8FE');
$this->addSql('ALTER TABLE partner_qualification_rate DROP FOREIGN KEY FK_666533BA1A75EE38');
$this->addSql('ALTER TABLE worker_absence_documents DROP FOREIGN KEY FK_5801A9E2DFF238F');
$this->addSql('ALTER TABLE worker_absences DROP FOREIGN KEY FK_F1993DA96B20BA36');
$this->addSql('DROP TABLE partner_qualification_rate');
$this->addSql('DROP TABLE worker_absence_documents');
$this->addSql('DROP TABLE worker_absences');
$this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE ai_hub_features CHANGE feature_key feature_key VARCHAR(255) NOT NULL, CHANGE state state VARCHAR(255) NOT NULL, CHANGE reason reason VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE calculation_permissions CHANGE type type VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE desktop_settings CHANGE default_language default_language VARCHAR(255) DEFAULT NULL, CHANGE social_insurance_country social_insurance_country VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE material_request CHANGE status status VARCHAR(255) DEFAULT \'draft\' NOT NULL');
$this->addSql('ALTER TABLE material_request_documents CHANGE status status VARCHAR(255) DEFAULT \'pending\' 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, CHANGE status status VARCHAR(255) DEFAULT \'draft\' NOT NULL, CHANGE decline_reason_category decline_reason_category VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment_date_revisions CHANGE reason_category reason_category VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE project_order_task_fulfillment_messages CHANGE sender_side sender_side VARCHAR(255) NOT 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 task_fulfillment_stage_history CHANGE changed_by_scope changed_by_scope VARCHAR(255) DEFAULT NULL, CHANGE source source VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE task_fulfillment_stages CHANGE work_nature work_nature VARCHAR(255) DEFAULT NULL');
$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 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 \'active\' NOT NULL');
$this->addSql('ALTER TABLE worker DROP FOREIGN KEY FK_9FB2BF629588266F');
$this->addSql('DROP INDEX IDX_9FB2BF629588266F ON worker');
$this->addSql('DROP INDEX unique_personal_id ON worker');
$this->addSql('ALTER TABLE worker DROP default_qualification_id');
$this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
$this->addSql('ALTER TABLE works_plan_revisions CHANGE status status VARCHAR(255) NOT NULL');
}
}