vendor/bluue/categories-bundle/migrations/Version20231109090027.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace CategoriesBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20231109090027 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('ALTER TABLE categories_bundle__category_context ADD created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, ADD updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, ADD deleted_at DATETIME DEFAULT NULL');
  11.         $this->addSql('ALTER TABLE categories_bundle__category_context ADD CONSTRAINT FK_7E2E3ED7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  12.         $this->addSql('ALTER TABLE categories_bundle__category_context ADD CONSTRAINT FK_7E2E3ED7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  13.         $this->addSql('ALTER TABLE categories_bundle__category_context ADD CONSTRAINT FK_7E2E3ED7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
  14.         $this->addSql('CREATE INDEX IDX_7E2E3ED7B03A8386 ON categories_bundle__category_context (created_by_id)');
  15.         $this->addSql('CREATE INDEX IDX_7E2E3ED7896DBBDE ON categories_bundle__category_context (updated_by_id)');
  16.         $this->addSql('CREATE INDEX IDX_7E2E3ED7C76F1F52 ON categories_bundle__category_context (deleted_by_id)');
  17.         $this->addSql('CREATE INDEX deleted_at ON categories_bundle__category_context (deleted_at)');
  18.         $this->addSql('CREATE INDEX created_at ON categories_bundle__category_context (created_at)');
  19.         $this->addSql('CREATE INDEX updated_at ON categories_bundle__category_context (updated_at)');
  20.         $this->addSql('ALTER TABLE categories_bundle__category_context MODIFY created_at DATETIME NOT NULL, MODIFY updated_at DATETIME NOT NULL');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         $this->addSql('ALTER TABLE categories_bundle__category_context DROP FOREIGN KEY FK_7E2E3ED7B03A8386');
  25.         $this->addSql('ALTER TABLE categories_bundle__category_context DROP FOREIGN KEY FK_7E2E3ED7896DBBDE');
  26.         $this->addSql('ALTER TABLE categories_bundle__category_context DROP FOREIGN KEY FK_7E2E3ED7C76F1F52');
  27.         $this->addSql('DROP INDEX IDX_7E2E3ED7B03A8386 ON categories_bundle__category_context');
  28.         $this->addSql('DROP INDEX IDX_7E2E3ED7896DBBDE ON categories_bundle__category_context');
  29.         $this->addSql('DROP INDEX IDX_7E2E3ED7C76F1F52 ON categories_bundle__category_context');
  30.         $this->addSql('DROP INDEX deleted_at ON categories_bundle__category_context');
  31.         $this->addSql('DROP INDEX created_at ON categories_bundle__category_context');
  32.         $this->addSql('DROP INDEX updated_at ON categories_bundle__category_context');
  33.         $this->addSql('ALTER TABLE categories_bundle__category_context DROP created_by_id, DROP updated_by_id, DROP deleted_by_id, DROP created_at, DROP updated_at, DROP deleted_at');
  34.     }
  35. }