<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20231219105400 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('member_application_company_comment')->hasColumn('member_application_id'),
'The member_application_id column was already added to member_application_company_comment table!'
);
$commentTable = $schema->getTable('member_application_company_comment');
$commentTable->addColumn('member_application_id', Types::STRING, ['length' => 255])->setNotnull(true);
$commentTable->addForeignKeyConstraint(
$schema->getTable('member_application'),
['member_application_id'],
['id'],
[],
'fk_ma_company_comment_member_application'
);
$commentTable->addIndex(['member_application_id'], 'idx_ma_company_comment_member_application_id');
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('member_application_company_comment')->hasColumn('member_application_id'),
'The member_application_id column was already removed to member_application_company_comment table!'
);
$commentTable = $schema->getTable('member_application_company_comment');
$commentTable->dropIndex('idx_ma_company_comment_member_application_id');
$commentTable->dropColumn('member_application_id');
}
}