migrations/Version20230628184529.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 Version20230628184529 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('ALTER TABLE wsc_collaborator DROP FOREIGN KEY FK_1CFB7649A7C41D6F');
  19.         $this->addSql('ALTER TABLE wsc_option DROP FOREIGN KEY FK_5E8C9692F8697D13');
  20.         $this->addSql('DROP TABLE wsc_option');
  21.         $this->addSql('DROP INDEX IDX_1CFB7649A7C41D6F ON wsc_collaborator');
  22.         $this->addSql('ALTER TABLE wsc_collaborator DROP option_id');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('CREATE TABLE wsc_option (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', comment_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, sort_order INT DEFAULT NULL, created_at DATETIME NOT NULL, modified_at DATETIME NOT NULL, INDEX idx_name (name), INDEX IDX_5E8C9692F8697D13 (comment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  28.         $this->addSql('ALTER TABLE wsc_option ADD CONSTRAINT FK_5E8C9692F8697D13 FOREIGN KEY (comment_id) REFERENCES ws_comment (id) ON DELETE CASCADE');
  29.         $this->addSql('ALTER TABLE wsc_collaborator ADD option_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
  30.         $this->addSql('ALTER TABLE wsc_collaborator ADD CONSTRAINT FK_1CFB7649A7C41D6F FOREIGN KEY (option_id) REFERENCES wsc_option (id) ON DELETE SET NULL');
  31.         $this->addSql('CREATE INDEX IDX_1CFB7649A7C41D6F ON wsc_collaborator (option_id)');
  32.     }
  33. }