migrations/Version20231011193539.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 Version20231011193539 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 donation (id INT AUTO_INCREMENT NOT NULL, person_id INT DEFAULT NULL, legal_person_id INT DEFAULT NULL, section_id INT DEFAULT NULL, project_id INT DEFAULT NULL, amount DOUBLE PRECISION NOT NULL, amount_payed DOUBLE PRECISION NOT NULL, INDEX IDX_31E581A0217BBB47 (person_id), INDEX IDX_31E581A0CDB28416 (legal_person_id), INDEX IDX_31E581A0D823E37A (section_id), INDEX IDX_31E581A0166D1F9C (project_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE project (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(150) NOT NULL, description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE donation ADD CONSTRAINT FK_31E581A0217BBB47 FOREIGN KEY (person_id) REFERENCES person (id)');
  21.         $this->addSql('ALTER TABLE donation ADD CONSTRAINT FK_31E581A0CDB28416 FOREIGN KEY (legal_person_id) REFERENCES legal_person (id)');
  22.         $this->addSql('ALTER TABLE donation ADD CONSTRAINT FK_31E581A0D823E37A FOREIGN KEY (section_id) REFERENCES section (id)');
  23.         $this->addSql('ALTER TABLE donation ADD CONSTRAINT FK_31E581A0166D1F9C FOREIGN KEY (project_id) REFERENCES project (id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE donation DROP FOREIGN KEY FK_31E581A0217BBB47');
  29.         $this->addSql('ALTER TABLE donation DROP FOREIGN KEY FK_31E581A0CDB28416');
  30.         $this->addSql('ALTER TABLE donation DROP FOREIGN KEY FK_31E581A0D823E37A');
  31.         $this->addSql('ALTER TABLE donation DROP FOREIGN KEY FK_31E581A0166D1F9C');
  32.         $this->addSql('DROP TABLE donation');
  33.         $this->addSql('DROP TABLE project');
  34.     }
  35. }