migrations/Version20240901000000.php line 1

Open in your IDE?
  1. <?php
    
    declare(strict_types=1);
    
    namespace DoctrineMigrations;
    
    use Doctrine\DBAL\Schema\Schema;
    use Doctrine\Migrations\AbstractMigration;
    
    final class Version20240901000000 extends AbstractMigration
    {
        public function getDescription(): string
        {
            return 'Persist application-processing selections by stage and level.';
        }
    
        public function up(Schema $schema): void
        {
            if ($schema->hasTable('application_processing_state')) {
                return;
            }
    
            $table = $schema->createTable('application_processing_state');
            $table->addColumn('id', 'integer', ['autoincrement' => true]);
            $table->addColumn('level', 'string', ['length' => 50]);
            $table->addColumn('stage', 'string', ['length' => 50]);
            $table->addColumn('selection', 'json', ['notnull' => false]);
            $table->addColumn('validated', 'boolean');
            $table->setPrimaryKey(['id']);
            $table->addUniqueIndex(['level', 'stage'], 'app_processing_level_stage_unique');
        }
    
        public function down(Schema $schema): void
        {
            if ($schema->hasTable('application_processing_state')) {
                $schema->dropTable('application_processing_state');
            }
        }
    }