migrations/Version20260609064815.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20260609064815 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE customer_education ADD CONSTRAINT FK_70F7A6C89395C3F3 FOREIGN KEY (customer_id) REFERENCES project_owner (id)');
  21.         $this->addSql('ALTER TABLE todo_comments ADD CONSTRAINT FK_7849DE4AEA1EBC33 FOREIGN KEY (todo_id) REFERENCES todos (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE todo_comments ADD CONSTRAINT FK_7849DE4AF675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role ENUM(\'intern\', \'extern\') DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE calculation_permissions CHANGE type type ENUM(\'total\', \'average\', \'profit\', \'margin\', \'detail_report\') NOT NULL');
  25.         $this->addSql('ALTER TABLE project_order_billings ADD documents JSON DEFAULT NULL');
  26.         $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');
  27.         $this->addSql('ALTER TABLE projects CHANGE type type ENUM(\'project\', \'daily_work\') DEFAULT \'project\'');
  28.         $this->addSql('ALTER TABLE purchase_request_histories CHANGE sender_mode sender_mode ENUM(\'approver\', \'requester\') DEFAULT NULL');
  29.         $this->addSql('ALTER TABLE purchase_request_status CHANGE status status ENUM(\'pending\', \'approved\', \'rejected\', \'delivered\') NOT NULL');
  30.         $this->addSql('ALTER TABLE stock_transactions CHANGE transaction_type transaction_type ENUM(\'in\', \'out\', \'move\') NOT NULL');
  31.         $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');
  32.         $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');
  33.         $this->addSql('DROP INDEX unique_personal_id ON worker');
  34.         $this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         // this down() migration is auto-generated, please modify it to your needs
  39.         $this->addSql('ALTER TABLE customer_education DROP FOREIGN KEY FK_70F7A6C89395C3F3');
  40.         $this->addSql('ALTER TABLE todo_comments DROP FOREIGN KEY FK_7849DE4AEA1EBC33');
  41.         $this->addSql('ALTER TABLE todo_comments DROP FOREIGN KEY FK_7849DE4AF675F31B');
  42.         $this->addSql('DROP TABLE customer_education');
  43.         $this->addSql('DROP TABLE todo_comments');
  44.         $this->addSql('ALTER TABLE access_modules CHANGE access_module_role access_module_role VARCHAR(255) DEFAULT NULL');
  45.         $this->addSql('ALTER TABLE calculation_permissions CHANGE type type VARCHAR(255) NOT NULL');
  46.         $this->addSql('ALTER TABLE project_order_billings DROP documents');
  47.         $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');
  48.         $this->addSql('ALTER TABLE projects CHANGE type type VARCHAR(255) DEFAULT \'project\'');
  49.         $this->addSql('ALTER TABLE purchase_request_histories CHANGE sender_mode sender_mode VARCHAR(255) DEFAULT NULL');
  50.         $this->addSql('ALTER TABLE purchase_request_status CHANGE status status VARCHAR(255) NOT NULL');
  51.         $this->addSql('ALTER TABLE stock_transactions CHANGE transaction_type transaction_type VARCHAR(255) NOT NULL');
  52.         $this->addSql('ALTER TABLE todo_notifications DROP type, DROP comment_id, CHANGE status status VARCHAR(20) NOT NULL');
  53.         $this->addSql('ALTER TABLE vendor CHANGE vendor_type vendor_type VARCHAR(255) DEFAULT NULL, CHANGE vendor_status vendor_status VARCHAR(255) DEFAULT NULL');
  54.         $this->addSql('DROP INDEX unique_personal_id ON worker');
  55.         $this->addSql('CREATE UNIQUE INDEX unique_personal_id ON worker (personal_id)');
  56.     }
  57. }