migrations/Version20220626184735.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 Version20220626184735 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('SET FOREIGN_KEY_CHECKS = 0;');
  19.         $this->addSql('CREATE TABLE IF NOT EXISTS std_domains_values_content (id INT AUTO_INCREMENT NOT NULL, domain_value_id INT NOT NULL, language_code VARCHAR(2) NOT NULL, description VARCHAR(255) NOT NULL, attributes JSON DEFAULT NULL, INDEX IDX_B090D5CBEAAEF4ED (domain_value_id), PRIMARY KEY(id),CONSTRAINT FK_B090D5CBEAAEF4ED FOREIGN KEY (domain_value_id) REFERENCES std_domains_values (id) ON DELETE CASCADE) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE std_domains_values DROP FOREIGN KEY FK_3A0935D7115F0EE5');
  21.         $this->addSql('ALTER TABLE std_domains_values ADD CONSTRAINT FK_3A0935D7115F0EE5 FOREIGN KEY (domain_id) REFERENCES std_domains (id) ON DELETE CASCADE');
  22.         $this->addSql('SET FOREIGN_KEY_CHECKS = 1;');
  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 std_domains_values DROP FOREIGN KEY FK_3A0935D7115F0EE5');
  28.         $this->addSql('ALTER TABLE std_domains_values ADD CONSTRAINT FK_3A0935D7115F0EE5 FOREIGN KEY (domain_id) REFERENCES std_domains (id)');
  29.         $this->addSql('DROP TABLE std_domains_values_content');
  30.     }
  31. }