<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20220913123615 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('ticket')->hasColumn('member_application_id'),
'The member_application_id field was already added in the ticket table!'
);
$schema->getTable('ticket')->addColumn(
'member_application_id',
Types::STRING,
[
'length' => 255,
'notnull' => false,
'default' => 'null',
]
);
$schema->getTable('ticket')->addForeignKeyConstraint(
'member_application',
['member_application_id'],
['id'],
[],
'fk_ticket_member_application'
);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('ticket')->hasColumn('member_application_id'),
'The member_application_id field was already removed from the ticket table!'
);
$schema->getTable('ticket')->dropIndex('fk_ticket_member_application');
$schema->getTable('ticket')->dropColumn('member_application_id');
}
}