migrations/Version20231204121200.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 Version20231204121200 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return '';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf(
  16.             true === $schema->hasTable('member_application_company_comment'),
  17.             'The member_application_company_comment table was already created!'
  18.         );
  19.         $commentTable $schema->createTable('member_application_company_comment');
  20.         $commentTable->addColumn('id'Types::GUID)->setNotnull(true);
  21.         $commentTable->addColumn('first_name'Types::STRING, ['length' => 255])->setNotnull(false);
  22.         $commentTable->addColumn('last_name'Types::STRING, ['length' => 255])->setNotnull(false);
  23.         $commentTable->addColumn('comment'Types::TEXT)->setNotnull(true);
  24.         $commentTable->addColumn('created_at'Types::DATETIME_IMMUTABLE)->setNotnull(true);
  25.         $commentTable->addColumn('company_user_id'Types::STRING, ['length' => 255])->setNotnull(true);
  26.         $commentTable->setPrimaryKey(['id']);
  27.         $commentTable->addForeignKeyConstraint(
  28.             $schema->getTable('company_user'),
  29.             ['company_user_id'],
  30.             ['id'],
  31.             [],
  32.             'fk_macc_company_user'
  33.         );
  34.         $commentTable->addIndex(['company_user_id'], 'idx_ma_company_comment_company_user_id');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         $this->skipIf(
  39.             false === $schema->hasTable('member_application_company_comment'),
  40.             'The member_application_company_comment tables was already removed!'
  41.         );
  42.         $schema->dropTable('member_application_company_comment');
  43.     }
  44. }