<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240627152200 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add member application process table';
}
public function up(Schema $schema): void
{
$this->skipIf($schema->hasTable('member_application_process'), 'Table member_application_process already exists');
$table = $schema->createTable('member_application_process');
$table->addColumn('id', Types::GUID)->setNotnull(true);
$table->addColumn('member_application_id', Types::INTEGER)->setNotnull(false);
$table->addColumn('is_form_complete', Types::BOOLEAN)->setNotnull(true)->setDefault(false);
$table->addColumn('is_b2b_form', Types::BOOLEAN)->setNotnull(true)->setDefault(false);
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint('process', ['id'], ['id'], ['onDelete' => 'CASCADE'], 'fk_process_member_application_process');
$table->addForeignKeyConstraint('member_application', ['member_application_id'], ['id'], [], 'fk_member_application_process');
}
public function down(Schema $schema): void
{
$this->skipIf(!$schema->hasTable('member_application_process'), 'Table member_application_process does not exist');
$schema->dropTable('member_application_process');
}
}