migrations/Version20210910100012.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 Version20210910100012 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 request_comment DROP FOREIGN KEY FK_BE50203B427EB8A5');
  19.         $this->addSql('ALTER TABLE request_file DROP FOREIGN KEY FK_F33811EA427EB8A5');
  20.         $this->addSql('ALTER TABLE request DROP FOREIGN KEY FK_3B978F9F75A68C6C');
  21.         $this->addSql('CREATE TABLE demand (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, demand_information_id INT NOT NULL, status INT NOT NULL, description LONGTEXT NOT NULL, step INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_428D7973A76ED395 (user_id), UNIQUE INDEX UNIQ_428D79739A8FFC58 (demand_information_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE demand_comment (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, content LONGTEXT NOT NULL, status INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_3B0EBCB55D022E59 (demand_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE demand_file (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, file_id INT NOT NULL, type INT NOT NULL, INDEX IDX_525D96565D022E59 (demand_id), UNIQUE INDEX UNIQ_525D965693CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('CREATE TABLE demand_information (id INT AUTO_INCREMENT NOT NULL, lastname VARCHAR(255) NOT NULL, firstname VARCHAR(255) NOT NULL, date_of_birth DATE NOT NULL, address VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, postal_code INT NOT NULL, phone VARCHAR(10) NOT NULL, additional_address VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  25.         $this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D7973A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  26.         $this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D79739A8FFC58 FOREIGN KEY (demand_information_id) REFERENCES demand_information (id)');
  27.         $this->addSql('ALTER TABLE demand_comment ADD CONSTRAINT FK_3B0EBCB55D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
  28.         $this->addSql('ALTER TABLE demand_file ADD CONSTRAINT FK_525D96565D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
  29.         $this->addSql('ALTER TABLE demand_file ADD CONSTRAINT FK_525D965693CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
  30.         $this->addSql('DROP TABLE request');
  31.         $this->addSql('DROP TABLE request_comment');
  32.         $this->addSql('DROP TABLE request_file');
  33.         $this->addSql('DROP TABLE request_information');
  34.     }
  35.     public function down(Schema $schema): void
  36.     {
  37.         // this down() migration is auto-generated, please modify it to your needs
  38.         $this->addSql('ALTER TABLE demand_comment DROP FOREIGN KEY FK_3B0EBCB55D022E59');
  39.         $this->addSql('ALTER TABLE demand_file DROP FOREIGN KEY FK_525D96565D022E59');
  40.         $this->addSql('ALTER TABLE demand DROP FOREIGN KEY FK_428D79739A8FFC58');
  41.         $this->addSql('CREATE TABLE request (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, request_information_id INT NOT NULL, status INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', description LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, step INT NOT NULL, INDEX IDX_3B978F9FA76ED395 (user_id), UNIQUE INDEX UNIQ_3B978F9F75A68C6C (request_information_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  42.         $this->addSql('CREATE TABLE request_comment (id INT AUTO_INCREMENT NOT NULL, request_id INT NOT NULL, content LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, status INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BE50203B427EB8A5 (request_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  43.         $this->addSql('CREATE TABLE request_file (id INT AUTO_INCREMENT NOT NULL, request_id INT NOT NULL, file_id INT NOT NULL, type INT NOT NULL, INDEX IDX_F33811EA427EB8A5 (request_id), UNIQUE INDEX UNIQ_F33811EA93CB796C (file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  44.         $this->addSql('CREATE TABLE request_information (id INT AUTO_INCREMENT NOT NULL, lastname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, firstname VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, date_of_birth DATE NOT NULL, address VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, city VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, postal_code INT NOT NULL, phone VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, additional_address VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  45.         $this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9F75A68C6C FOREIGN KEY (request_information_id) REFERENCES request_information (id)');
  46.         $this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  47.         $this->addSql('ALTER TABLE request_comment ADD CONSTRAINT FK_BE50203B427EB8A5 FOREIGN KEY (request_id) REFERENCES request (id)');
  48.         $this->addSql('ALTER TABLE request_file ADD CONSTRAINT FK_F33811EA427EB8A5 FOREIGN KEY (request_id) REFERENCES request (id)');
  49.         $this->addSql('ALTER TABLE request_file ADD CONSTRAINT FK_F33811EA93CB796C FOREIGN KEY (file_id) REFERENCES file (id)');
  50.         $this->addSql('DROP TABLE demand');
  51.         $this->addSql('DROP TABLE demand_comment');
  52.         $this->addSql('DROP TABLE demand_file');
  53.         $this->addSql('DROP TABLE demand_information');
  54.     }
  55. }