You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 line
6.2KB

  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 Version20210531143333 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 collectif_data (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, territory_id INT DEFAULT NULL, nb_participant INT NOT NULL, INDEX IDX_F35F8503A76ED395 (user_id), INDEX IDX_F35F850373F74AD4 (territory_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('CREATE TABLE configuration (id INT AUTO_INCREMENT NOT NULL, value VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20. $this->addSql('CREATE TABLE dreams (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_FD07CC0AE2920B1 (individual_data_id), INDEX IDX_FD07CC0AD9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21. $this->addSql('CREATE TABLE individual_data (id INT AUTO_INCREMENT NOT NULL, firstname VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, intro_question VARCHAR(255) NOT NULL, intro_answer VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22. $this->addSql('CREATE TABLE projects_boost (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_C3E57356E2920B1 (individual_data_id), INDEX IDX_C3E57356D9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23. $this->addSql('CREATE TABLE projects_inspiring (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_E60CAEC6E2920B1 (individual_data_id), INDEX IDX_E60CAEC6D9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24. $this->addSql('CREATE TABLE revolts (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, collectif_data_id INT DEFAULT NULL, INDEX IDX_68E7DC9FE2920B1 (individual_data_id), INDEX IDX_68E7DC9FD9275BF1 (collectif_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  25. $this->addSql('CREATE TABLE territory (id INT AUTO_INCREMENT NOT NULL, individual_data_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_E9743966E2920B1 (individual_data_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  26. $this->addSql('CREATE TABLE thematic (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  27. $this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F8503A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  28. $this->addSql('ALTER TABLE collectif_data ADD CONSTRAINT FK_F35F850373F74AD4 FOREIGN KEY (territory_id) REFERENCES territory (id)');
  29. $this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
  30. $this->addSql('ALTER TABLE dreams ADD CONSTRAINT FK_FD07CC0AD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
  31. $this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
  32. $this->addSql('ALTER TABLE projects_boost ADD CONSTRAINT FK_C3E57356D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
  33. $this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
  34. $this->addSql('ALTER TABLE projects_inspiring ADD CONSTRAINT FK_E60CAEC6D9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
  35. $this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FE2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
  36. $this->addSql('ALTER TABLE revolts ADD CONSTRAINT FK_68E7DC9FD9275BF1 FOREIGN KEY (collectif_data_id) REFERENCES collectif_data (id)');
  37. $this->addSql('ALTER TABLE territory ADD CONSTRAINT FK_E9743966E2920B1 FOREIGN KEY (individual_data_id) REFERENCES individual_data (id)');
  38. }
  39. public function down(Schema $schema): void
  40. {
  41. // this down() migration is auto-generated, please modify it to your needs
  42. $this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AD9275BF1');
  43. $this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356D9275BF1');
  44. $this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6D9275BF1');
  45. $this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FD9275BF1');
  46. $this->addSql('ALTER TABLE dreams DROP FOREIGN KEY FK_FD07CC0AE2920B1');
  47. $this->addSql('ALTER TABLE projects_boost DROP FOREIGN KEY FK_C3E57356E2920B1');
  48. $this->addSql('ALTER TABLE projects_inspiring DROP FOREIGN KEY FK_E60CAEC6E2920B1');
  49. $this->addSql('ALTER TABLE revolts DROP FOREIGN KEY FK_68E7DC9FE2920B1');
  50. $this->addSql('ALTER TABLE territory DROP FOREIGN KEY FK_E9743966E2920B1');
  51. $this->addSql('ALTER TABLE collectif_data DROP FOREIGN KEY FK_F35F850373F74AD4');
  52. $this->addSql('DROP TABLE collectif_data');
  53. $this->addSql('DROP TABLE configuration');
  54. $this->addSql('DROP TABLE dreams');
  55. $this->addSql('DROP TABLE individual_data');
  56. $this->addSql('DROP TABLE projects_boost');
  57. $this->addSql('DROP TABLE projects_inspiring');
  58. $this->addSql('DROP TABLE revolts');
  59. $this->addSql('DROP TABLE territory');
  60. $this->addSql('DROP TABLE thematic');
  61. }
  62. }