<?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 Version20260609064815 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 customer_education (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, prompt LONGTEXT NOT NULL, INDEX IDX_70F7A6C89395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE todo_comments (id INT AUTO_INCREMENT NOT NULL, todo_id INT NOT NULL, author_id INT NOT NULL, body LONGTEXT NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_7849DE4AEA1EBC33 (todo_id), INDEX IDX_7849DE4AF675F31B (author_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE customer_education ADD CONSTRAINT FK_70F7A6C89395C3F3 FOREIGN KEY (customer_id) REFERENCES project_owner (id)');
$this->addSql('ALTER TABLE todo_comments ADD CONSTRAINT FK_7849DE4AEA1EBC33 FOREIGN KEY (todo_id) REFERENCES todos (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE todo_comments ADD CONSTRAINT FK_7849DE4AF675F31B FOREIGN KEY (author_id) REFERENCES user (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 calculation_permissions CHANGE type type ENUM(\'total\', \'average\', \'profit\', \'margin\', \'detail_report\') NOT NULL');
$this->addSql('ALTER TABLE project_order_billings ADD documents JSON DEFAULT 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_notifications ADD type VARCHAR(20) DEFAULT \'status\' NOT NULL, ADD comment_id INT DEFAULT NULL, CHANGE status status VARCHAR(20) 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)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customer_education DROP FOREIGN KEY FK_70F7A6C89395C3F3');
$this->addSql('ALTER TABLE todo_comments DROP FOREIGN KEY FK_7849DE4AEA1EBC33');
$this->addSql('ALTER TABLE todo_comments DROP FOREIGN KEY FK_7849DE4AF675F31B');
$this->addSql('DROP TABLE customer_education');
$this->addSql('DROP TABLE todo_comments');
$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_billings DROP documents');
$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_notifications DROP type, DROP comment_id, CHANGE status status VARCHAR(20) NOT 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)');
}
}