<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20231203095900 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->hasTable('member_application_health_mutual_comment'),
'The member_application_health_mutual_comment table was already created!'
);
$commentTable = $schema->createTable('member_application_health_mutual_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('health_mutual_user_id', Types::STRING, ['length' => 255])->setNotnull(true);
$commentTable->setPrimaryKey(['id']);
$commentTable->addForeignKeyConstraint(
$schema->getTable('health_mutual_user'),
['health_mutual_user_id'],
['id'],
[],
'fk_mahmc_health_mutual_user'
);
$commentTable->addIndex(['health_mutual_user_id'], 'idx_ma_health_mutual_comment_health_mutual_user_id');
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->hasTable('member_application_health_mutual_comment'),
'The member_application_health_mutual_comment tables was already removed!'
);
$schema->dropTable('member_application_health_mutual_comment');
}
}