migrations/Version20221025173649.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 Version20221025173649 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 custom_choice (id INT AUTO_INCREMENT NOT NULL, trigger_form_id INT DEFAULT NULL, custom_input_id INT NOT NULL, text VARCHAR(255) NOT NULL, sort_order INT NOT NULL, date_added DATETIME NOT NULL, date_modified DATETIME NOT NULL, INDEX IDX_F5068E965BB69C44 (trigger_form_id), INDEX IDX_F5068E96D390FDB2 (custom_input_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE custom_input (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, name VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, possible_trigger TINYINT(1) NOT NULL, help VARCHAR(400) NOT NULL, active TINYINT(1) NOT NULL, date_added DATETIME NOT NULL, date_modified DATETIME NOT NULL, INDEX IDX_1B25CABEC54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE input_type (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, fqcn VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE custom_choice ADD CONSTRAINT FK_F5068E965BB69C44 FOREIGN KEY (trigger_form_id) REFERENCES custom_input (id)');
  22.         $this->addSql('ALTER TABLE custom_choice ADD CONSTRAINT FK_F5068E96D390FDB2 FOREIGN KEY (custom_input_id) REFERENCES custom_input (id)');
  23.         $this->addSql('ALTER TABLE custom_input ADD CONSTRAINT FK_1B25CABEC54C8C93 FOREIGN KEY (type_id) REFERENCES input_type (id)');
  24.         $this->addSql("INSERT INTO `input_type` (`id`, `name`, `fqcn`) VALUES (1, 'TextType', 'Symfony\\\Component\\Form\\Extension\\Core\\Type\\TextType');");
  25.         $this->addSql("INSERT INTO `input_type` (`id`, `name`, `fqcn`) VALUES (2, 'NumberType', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType');");
  26.         $this->addSql("INSERT INTO `input_type` (`id`, `name`, `fqcn`) VALUES (3, 'ChoiceType', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType');");
  27.         $this->addSql("INSERT INTO `input_type` (`id`, `name`, `fqcn`) VALUES (4, 'TextareaType', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType');");
  28.         $this->addSql("INSERT INTO `input_type` (`id`, `name`, `fqcn`) VALUES (5, 'FileType', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType');");
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         // this down() migration is auto-generated, please modify it to your needs
  33.         $this->addSql('ALTER TABLE custom_choice DROP FOREIGN KEY FK_F5068E965BB69C44');
  34.         $this->addSql('ALTER TABLE custom_choice DROP FOREIGN KEY FK_F5068E96D390FDB2');
  35.         $this->addSql('ALTER TABLE custom_input DROP FOREIGN KEY FK_1B25CABEC54C8C93');
  36.         $this->addSql('DROP TABLE custom_choice');
  37.         $this->addSql('DROP TABLE custom_input');
  38.         $this->addSql('DROP TABLE input_type');
  39.     }
  40. }