<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250603204533 extends AbstractMigration
{
public function getDescription(): string
{
return 'Rename payment_id to fee_id in service_attachment_position table';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE service_attachment_position DROP CONSTRAINT fk_83a8992f4c3a3bb');
$this->addSql('DROP INDEX idx_83a8992f4c3a3bb');
$this->addSql('ALTER TABLE service_attachment_position RENAME COLUMN payment_id TO fee_id');
$this->addSql('ALTER TABLE service_attachment_position ADD CONSTRAINT FK_83A8992FAB45AECA FOREIGN KEY (fee_id) REFERENCES fee (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_83A8992FAB45AECA ON service_attachment_position (fee_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE service_attachment_position DROP CONSTRAINT FK_83A8992FAB45AECA');
$this->addSql('DROP INDEX IDX_83A8992FAB45AECA');
$this->addSql('ALTER TABLE service_attachment_position RENAME COLUMN fee_id TO payment_id');
$this->addSql('ALTER TABLE service_attachment_position ADD CONSTRAINT fk_83a8992f4c3a3bb FOREIGN KEY (payment_id) REFERENCES abap_payment_position (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_83a8992f4c3a3bb ON service_attachment_position (payment_id)');
}
}