<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240926181054 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add completed_payment_id to shipment and payment_position_quantity to abap_payment';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE abap_payment ADD payment_position_quantity INT DEFAULT NULL');
$this->addSql('ALTER TABLE shipment ADD completed_payment_id UUID DEFAULT NULL');
$this->addSql('COMMENT ON COLUMN shipment.completed_payment_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCFF21A60C FOREIGN KEY (completed_payment_id) REFERENCES shipment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_2CB20DCFF21A60C ON shipment (completed_payment_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE abap_payment DROP payment_position_quantity');
$this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCFF21A60C');
$this->addSql('DROP INDEX IDX_2CB20DCFF21A60C');
$this->addSql('ALTER TABLE shipment DROP completed_payment_id');
}
}