<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240626164100 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add member school certificate process table';
}
public function up(Schema $schema): void
{
$this->skipIf($schema->hasTable('member_school_certificate_process'), 'Table member_school_certificate_process already exists');
$table = $schema->createTable('member_school_certificate_process');
$table->addColumn('id', Types::GUID)->setNotnull(true);
$table->addColumn('study_place', Types::STRING, ['length' => 255])->setNotnull(false);
$table->addColumn('start_at', Types::DATETIME_IMMUTABLE)->setNotnull(false);
$table->addColumn('end_at', Types::DATETIME_IMMUTABLE)->setNotnull(false);
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint('process', ['id'], ['id'], ['onDelete' => 'CASCADE'], 'fk_process_member_school_certificate_process');
}
public function down(Schema $schema): void
{
$this->skipIf(!$schema->hasTable('member_school_certificate_process'), 'Table member_school_certificate_process does not exist');
$schema->dropTable('member_school_certificate_process');
}
}