migrations/Version20240625114100.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\Migrations\AbstractMigration;
  7. final class Version20240625114100 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Add member address change process table';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf($schema->hasTable('member_address_change_process'), 'Table member_address_change_process already exists');
  16.         $table $schema->createTable('member_address_change_process');
  17.         $table->addColumn('id'Types::GUID)->setNotnull(true);
  18.         $table->addColumn('house_number'Types::STRING, ['length' => 255])->setNotnull(false);
  19.         $table->addColumn('street_line'Types::STRING, ['length' => 255])->setNotnull(false);
  20.         $table->addColumn('street_line2'Types::STRING, ['length' => 255])->setNotnull(false);
  21.         $table->addColumn('postal_code'Types::STRING, ['length' => 255])->setNotnull(false);
  22.         $table->addColumn('city'Types::STRING, ['length' => 255])->setNotnull(false);
  23.         $table->addColumn('country'Types::STRING, ['length' => 10])->setNotnull(false);
  24.         $table->addColumn('changed_address_member_ids'Types::JSON)->setNotnull(true)->setDefault('{}');
  25.         $table->setPrimaryKey(['id']);
  26.         $table->addForeignKeyConstraint('process', ['id'], ['id'], ['onDelete' => 'CASCADE'], 'fk_process_member_address_change_process');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         $this->skipIf(!$schema->hasTable('member_address_change_process'), 'Table member_address_change_process does not exist');
  31.         $schema->dropTable('member_address_change_process');
  32.     }
  33. }