migrations/Version20221127211537.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 Version20221127211537 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, supplier_region_id INT NOT NULL, PRIMARY KEY(supplier_id, supplier_region_id))');
  19.         $this->addSql('CREATE INDEX IDX_F78CCAED2ADD6D8C ON raport_send_supplier_region_join (supplier_id)');
  20.         $this->addSql('CREATE INDEX IDX_F78CCAED2143B8B ON raport_send_supplier_region_join (supplier_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_F78CCAED2143B8B FOREIGN KEY (supplier_region_id) REFERENCES raport_send_supplier_region (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('ALTER TABLE supplier_supplier_region DROP CONSTRAINT fk_bd03f3d62add6d8c');
  24.         $this->addSql('ALTER TABLE supplier_supplier_region DROP CONSTRAINT fk_bd03f3d62143b8b');
  25.         $this->addSql('DROP TABLE supplier_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_supplier_region (supplier_id INT NOT NULL, supplier_region_id INT NOT NULL, PRIMARY KEY(supplier_id, supplier_region_id))');
  32.         $this->addSql('CREATE INDEX idx_bd03f3d62143b8b ON supplier_supplier_region (supplier_region_id)');
  33.         $this->addSql('CREATE INDEX idx_bd03f3d62add6d8c ON supplier_supplier_region (supplier_id)');
  34.         $this->addSql('ALTER TABLE supplier_supplier_region ADD CONSTRAINT fk_bd03f3d62add6d8c FOREIGN KEY (supplier_id) REFERENCES raport_send_supplier (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  35.         $this->addSql('ALTER TABLE supplier_supplier_region ADD CONSTRAINT fk_bd03f3d62143b8b FOREIGN KEY (supplier_region_id) REFERENCES raport_send_supplier_region (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_F78CCAED2143B8B');
  38.         $this->addSql('DROP TABLE raport_send_supplier_region_join');
  39.     }
  40. }