migrations/Version20250603204533.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 Version20250603204533 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Rename payment_id to fee_id in service_attachment_position table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('ALTER TABLE service_attachment_position DROP CONSTRAINT fk_83a8992f4c3a3bb');
  15.         $this->addSql('DROP INDEX idx_83a8992f4c3a3bb');
  16.         $this->addSql('ALTER TABLE service_attachment_position RENAME COLUMN payment_id TO fee_id');
  17.         $this->addSql('ALTER TABLE service_attachment_position ADD CONSTRAINT FK_83A8992FAB45AECA FOREIGN KEY (fee_id) REFERENCES fee (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  18.         $this->addSql('CREATE INDEX IDX_83A8992FAB45AECA ON service_attachment_position (fee_id)');
  19.     }
  20.     public function down(Schema $schema): void
  21.     {
  22.         $this->addSql('ALTER TABLE service_attachment_position DROP CONSTRAINT FK_83A8992FAB45AECA');
  23.         $this->addSql('DROP INDEX IDX_83A8992FAB45AECA');
  24.         $this->addSql('ALTER TABLE service_attachment_position RENAME COLUMN fee_id TO payment_id');
  25.         $this->addSql('ALTER TABLE service_attachment_position ADD CONSTRAINT fk_83a8992f4c3a3bb FOREIGN KEY (payment_id) REFERENCES abap_payment_position (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  26.         $this->addSql('CREATE INDEX idx_83a8992f4c3a3bb ON service_attachment_position (payment_id)');
  27.     }
  28. }