migrations/Version20241105105721.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 Version20241105105721 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 article (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', title LONGTEXT NOT NULL, status TINYINT(1) NOT NULL, media_type LONGTEXT DEFAULT NULL, poi_type CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', entity_type VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_23A0E66D17F50A6 (uuid), INDEX IDX_23A0E66EA9FDD75 (media_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE article_locale (id INT AUTO_INCREMENT NOT NULL, article_id INT DEFAULT NULL, locale_id INT DEFAULT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_2B475118D17F50A6 (uuid), UNIQUE INDEX UNIQ_2B475118F47645AE (url), INDEX IDX_2B4751187294869C (article_id), INDEX IDX_2B475118E559DFD1 (locale_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66EA9FDD75 FOREIGN KEY (media_id) REFERENCES media (id) ON DELETE SET NULL');
  21.         $this->addSql('ALTER TABLE article_locale ADD CONSTRAINT FK_2B4751187294869C FOREIGN KEY (article_id) REFERENCES article (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE article_locale ADD CONSTRAINT FK_2B475118E559DFD1 FOREIGN KEY (locale_id) REFERENCES locale (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('ALTER TABLE article DROP FOREIGN KEY FK_23A0E66EA9FDD75');
  28.         $this->addSql('ALTER TABLE article_locale DROP FOREIGN KEY FK_2B4751187294869C');
  29.         $this->addSql('ALTER TABLE article_locale DROP FOREIGN KEY FK_2B475118E559DFD1');
  30.         $this->addSql('DROP TABLE article');
  31.         $this->addSql('DROP TABLE article_locale');
  32.     }
  33. }