<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20231204121200 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->hasTable('member_application_company_comment'),
'The member_application_company_comment table was already created!'
);
$commentTable = $schema->createTable('member_application_company_comment');
$commentTable->addColumn('id', Types::GUID)->setNotnull(true);
$commentTable->addColumn('first_name', Types::STRING, ['length' => 255])->setNotnull(false);
$commentTable->addColumn('last_name', Types::STRING, ['length' => 255])->setNotnull(false);
$commentTable->addColumn('comment', Types::TEXT)->setNotnull(true);
$commentTable->addColumn('created_at', Types::DATETIME_IMMUTABLE)->setNotnull(true);
$commentTable->addColumn('company_user_id', Types::STRING, ['length' => 255])->setNotnull(true);
$commentTable->setPrimaryKey(['id']);
$commentTable->addForeignKeyConstraint(
$schema->getTable('company_user'),
['company_user_id'],
['id'],
[],
'fk_macc_company_user'
);
$commentTable->addIndex(['company_user_id'], 'idx_ma_company_comment_company_user_id');
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->hasTable('member_application_company_comment'),
'The member_application_company_comment tables was already removed!'
);
$schema->dropTable('member_application_company_comment');
}
}