migrations/Version20220930145423.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 Version20220930145423 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'New table: autocomplete_bic';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf(
  16.             true === $schema->hasTable('autocomplete_bic'),
  17.             'The autocomplete_bic table already exists!'
  18.         );
  19.         $table $schema->createTable('autocomplete_bic');
  20.         $table->addColumn('iban_code'Types::INTEGER, ['length' => 40])->setNotnull(true);
  21.         $table->addColumn('bic'Types::STRING, ['length' => 12])->setNotnull(true);
  22.         $table->addColumn('credit_institution'Types::STRING, ['length' => 120])->setNotnull(true);
  23.         $table->setPrimaryKey(['iban_code']);
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         $this->skipIf(
  28.             false === $schema->hasTable('autocomplete_bic'),
  29.             'The autocomplete_bic table has already been removed!'
  30.         );
  31.         $schema->dropTable('autocomplete_bic');
  32.     }
  33. }