migrations/Version20240626164100.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 Version20240626164100 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Add member school certificate process table';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf($schema->hasTable('member_school_certificate_process'), 'Table member_school_certificate_process already exists');
  16.         $table $schema->createTable('member_school_certificate_process');
  17.         $table->addColumn('id'Types::GUID)->setNotnull(true);
  18.         $table->addColumn('study_place'Types::STRING, ['length' => 255])->setNotnull(false);
  19.         $table->addColumn('start_at'Types::DATETIME_IMMUTABLE)->setNotnull(false);
  20.         $table->addColumn('end_at'Types::DATETIME_IMMUTABLE)->setNotnull(false);
  21.         $table->setPrimaryKey(['id']);
  22.         $table->addForeignKeyConstraint('process', ['id'], ['id'], ['onDelete' => 'CASCADE'], 'fk_process_member_school_certificate_process');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $this->skipIf(!$schema->hasTable('member_school_certificate_process'), 'Table member_school_certificate_process does not exist');
  27.         $schema->dropTable('member_school_certificate_process');
  28.     }
  29. }