migrations/Version20221129172551.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 Version20221129172551 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 raport_send_supplier_region_join (supplier_id INT NOT NULL, region_id INT NOT NULL, PRIMARY KEY(supplier_id, region_id))');
  19.         $this->addSql('CREATE INDEX IDX_F78CCAED2ADD6D8C ON raport_send_supplier_region_join (supplier_id)');
  20.         $this->addSql('CREATE INDEX IDX_F78CCAED98260155 ON raport_send_supplier_region_join (region_id)');
  21.         $this->addSql('ALTER TABLE raport_send_supplier_region_join ADD CONSTRAINT FK_F78CCAED2ADD6D8C FOREIGN KEY (supplier_id) REFERENCES raport_send_supplier (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  22.         $this->addSql('ALTER TABLE raport_send_supplier_region_join ADD CONSTRAINT FK_F78CCAED98260155 FOREIGN KEY (region_id) REFERENCES admin_structure_region (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('ALTER TABLE supplier_region DROP CONSTRAINT fk_d40023a298260155');
  24.         $this->addSql('ALTER TABLE supplier_region DROP CONSTRAINT fk_d40023a22add6d8c');
  25.         $this->addSql('DROP TABLE supplier_region');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('CREATE SCHEMA public');
  31.         $this->addSql('CREATE TABLE supplier_region (supplier_id INT NOT NULL, region_id INT NOT NULL, PRIMARY KEY(supplier_id, region_id))');
  32.         $this->addSql('CREATE INDEX idx_d40023a298260155 ON supplier_region (region_id)');
  33.         $this->addSql('CREATE INDEX idx_d40023a22add6d8c ON supplier_region (supplier_id)');
  34.         $this->addSql('ALTER TABLE supplier_region ADD CONSTRAINT fk_d40023a298260155 FOREIGN KEY (region_id) REFERENCES admin_structure_region (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  35.         $this->addSql('ALTER TABLE supplier_region ADD CONSTRAINT fk_d40023a22add6d8c FOREIGN KEY (supplier_id) REFERENCES raport_send_supplier (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  36.         $this->addSql('ALTER TABLE raport_send_supplier_region_join DROP CONSTRAINT FK_F78CCAED2ADD6D8C');
  37.         $this->addSql('ALTER TABLE raport_send_supplier_region_join DROP CONSTRAINT FK_F78CCAED98260155');
  38.         $this->addSql('DROP TABLE raport_send_supplier_region_join');
  39.     }
  40. }