migrations/Version20220202213018.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. final class Version20220202213018 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('ALTER TABLE payment ADD auction_id INT DEFAULT NULL, ADD client_id INT DEFAULT NULL, ADD status INT NOT NULL, ADD debit INT NOT NULL, ADD notes LONGTEXT DEFAULT NULL');
  11.         $this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D57B8F0DE FOREIGN KEY (auction_id) REFERENCES auction (id)');
  12.         $this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D19EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
  13.         $this->addSql('CREATE INDEX IDX_6D28840D57B8F0DE ON payment (auction_id)');
  14.         $this->addSql('CREATE INDEX IDX_6D28840D19EB6921 ON payment (client_id)');
  15.     }
  16.     public function down(Schema $schema): void
  17.     {
  18.         $this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D57B8F0DE');
  19.         $this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D19EB6921');
  20.         $this->addSql('DROP INDEX IDX_6D28840D57B8F0DE ON payment');
  21.         $this->addSql('DROP INDEX IDX_6D28840D19EB6921 ON payment');
  22.         $this->addSql('ALTER TABLE payment DROP auction_id, DROP client_id, DROP status, DROP debit, DROP notes');
  23.     }
  24. }