migrations/Version20220613031449.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 Version20220613031449 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('ALTER TABLE incoming_order ADD notes LONGTEXT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE product_in DROP FOREIGN KEY FK_A5518F442ADD6D8C');
  20.         $this->addSql('ALTER TABLE product_in DROP FOREIGN KEY FK_A5518F44A76ED395');
  21.         $this->addSql('DROP INDEX IDX_A5518F44A76ED395 ON product_in');
  22.         $this->addSql('DROP INDEX IDX_A5518F442ADD6D8C ON product_in');
  23.         $this->addSql('ALTER TABLE product_in ADD incoming_order_id INT DEFAULT NULL, DROP user_id, DROP supplier_id, DROP date, DROP completed');
  24.         $this->addSql('ALTER TABLE product_in ADD CONSTRAINT FK_A5518F44C39E3F7F FOREIGN KEY (incoming_order_id) REFERENCES incoming_order (id)');
  25.         $this->addSql('CREATE INDEX IDX_A5518F44C39E3F7F ON product_in (incoming_order_id)');
  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('ALTER TABLE incoming_order DROP notes');
  31.         $this->addSql('ALTER TABLE product_in DROP FOREIGN KEY FK_A5518F44C39E3F7F');
  32.         $this->addSql('DROP INDEX IDX_A5518F44C39E3F7F ON product_in');
  33.         $this->addSql('ALTER TABLE product_in ADD supplier_id INT DEFAULT NULL, ADD date DATE NOT NULL, ADD completed TINYINT(1) DEFAULT 0 NOT NULL, CHANGE incoming_order_id user_id INT DEFAULT NULL');
  34.         $this->addSql('ALTER TABLE product_in ADD CONSTRAINT FK_A5518F442ADD6D8C FOREIGN KEY (supplier_id) REFERENCES supplier (id)');
  35.         $this->addSql('ALTER TABLE product_in ADD CONSTRAINT FK_A5518F44A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  36.         $this->addSql('CREATE INDEX IDX_A5518F44A76ED395 ON product_in (user_id)');
  37.         $this->addSql('CREATE INDEX IDX_A5518F442ADD6D8C ON product_in (supplier_id)');
  38.     }
  39. }