<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240625114100 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add member address change process table';
}
public function up(Schema $schema): void
{
$this->skipIf($schema->hasTable('member_address_change_process'), 'Table member_address_change_process already exists');
$table = $schema->createTable('member_address_change_process');
$table->addColumn('id', Types::GUID)->setNotnull(true);
$table->addColumn('house_number', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('street_line', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('street_line2', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('postal_code', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('city', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('country', Types::STRING, ['length' => 10])->setNotnull(false);
$table->addColumn('changed_address_member_ids', Types::JSON)->setNotnull(true)->setDefault('{}');
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint('process', ['id'], ['id'], ['onDelete' => 'CASCADE'], 'fk_process_member_address_change_process');
}
public function down(Schema $schema): void
{
$this->skipIf(!$schema->hasTable('member_address_change_process'), 'Table member_address_change_process does not exist');
$schema->dropTable('member_address_change_process');
}
}