vendor/bluue/projects-bundle/migrations/Version20230831143147.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ProjectsBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20230831143147 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('ALTER TABLE projects_bundle__task_user DROP FOREIGN KEY FK_D247F12B166D1F9C');
  11.         $this->addSql('DROP INDEX IDX_D247F12B166D1F9C ON projects_bundle__task_user');
  12.         $this->addSql('DROP INDEX `primary` ON projects_bundle__task_user');
  13.         $this->addSql('ALTER TABLE projects_bundle__task_user CHANGE project_id task_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
  14.         $this->addSql('ALTER TABLE projects_bundle__task_user ADD CONSTRAINT FK_D247F12B8DB60186 FOREIGN KEY (task_id) REFERENCES projects_bundle__task (id)');
  15.         $this->addSql('CREATE INDEX IDX_D247F12B8DB60186 ON projects_bundle__task_user (task_id)');
  16.         $this->addSql('ALTER TABLE projects_bundle__task_user ADD PRIMARY KEY (task_id, user_id)');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE projects_bundle__task_user DROP FOREIGN KEY FK_D247F12B8DB60186');
  21.         $this->addSql('DROP INDEX IDX_D247F12B8DB60186 ON projects_bundle__task_user');
  22.         $this->addSql('DROP INDEX `PRIMARY` ON projects_bundle__task_user');
  23.         $this->addSql('ALTER TABLE projects_bundle__task_user CHANGE task_id project_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
  24.         $this->addSql('ALTER TABLE projects_bundle__task_user ADD CONSTRAINT FK_D247F12B166D1F9C FOREIGN KEY (project_id) REFERENCES projects_bundle__task (id)');
  25.         $this->addSql('CREATE INDEX IDX_D247F12B166D1F9C ON projects_bundle__task_user (project_id)');
  26.         $this->addSql('ALTER TABLE projects_bundle__task_user ADD PRIMARY KEY (project_id, user_id)');
  27.     }
  28. }