migrations/Version20230220025042.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 Version20230220025042 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 interest_point (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, mail VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, lat_long VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE interest_point_category_interest_point (interest_point_id INT NOT NULL, category_interest_point_id INT NOT NULL, INDEX IDX_EADA4EF5BCFB5B62 (interest_point_id), INDEX IDX_EADA4EF556AB21E2 (category_interest_point_id), PRIMARY KEY(interest_point_id, category_interest_point_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE interest_point_category_interest_point ADD CONSTRAINT FK_EADA4EF5BCFB5B62 FOREIGN KEY (interest_point_id) REFERENCES interest_point (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE interest_point_category_interest_point ADD CONSTRAINT FK_EADA4EF556AB21E2 FOREIGN KEY (category_interest_point_id) REFERENCES category_interest_point (id) ON DELETE CASCADE');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE interest_point_category_interest_point DROP FOREIGN KEY FK_EADA4EF5BCFB5B62');
  27.         $this->addSql('ALTER TABLE interest_point_category_interest_point DROP FOREIGN KEY FK_EADA4EF556AB21E2');
  28.         $this->addSql('DROP TABLE interest_point');
  29.         $this->addSql('DROP TABLE interest_point_category_interest_point');
  30.     }
  31. }