migrations/Version20240604115200.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 Version20240604115200 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Add exchange api users';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf(
  16.             true === $schema->hasTable('exchange_api_user'),
  17.             'The exchange_api_user tables were already created!'
  18.         );
  19.         $table $schema->createTable('exchange_api_user');
  20.         $table->addColumn('id'Types::GUID)->setNotnull(true);
  21.         $table->addColumn('first_name'Types::STRING, ['length' => 80])->setNotnull(false)->setDefault(null);
  22.         $table->addColumn('last_name'Types::STRING, ['length' => 80])->setNotnull(false)->setDefault(null);
  23.         $table->addColumn('organization'Types::STRING, ['length' => 80])->setNotnull(true);
  24.         $table->addColumn('email'Types::STRING, ['length' => 80])->setNotnull(true);
  25.         $table->addColumn('phone'Types::STRING, ['length' => 80])->setNotnull(false)->setDefault(null);
  26.         $table->addColumn('roles'Types::JSON)->setNotnull(true);
  27.         $table->addColumn('created_at'Types::DATETIME_IMMUTABLE)->setNotnull(true);
  28.         $table->addColumn('last_modified_at'Types::DATETIME_IMMUTABLE)->setNotnull(true);
  29.         $table->addColumn('deleted_at'Types::DATETIME_IMMUTABLE)->setNotnull(false)->setDefault(null);
  30.         $table->addColumn('password'Types::STRING, ['length' => 80])->setNotnull(true);
  31.         $table->setPrimaryKey(['id']);
  32.     }
  33.     public function down(Schema $schema): void
  34.     {
  35.         $this->skipIf(
  36.             false === $schema->hasTable('exchange_api_user'),
  37.             'The exchange_api_user tables were already removed!'
  38.         );
  39.         $schema->dropTable('exchange_api_user');
  40.     }
  41. }