migrations/Version20240920000000.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 Version20240920000000 extends AbstractMigration
    {
        public function getDescription(): string
        {
            return 'Add weights and grade adjustments to application_processing_state';
        }
    
        public function up(Schema $schema): void
        {
            if ($schema->hasTable('application_processing_state')) {
                $table = $schema->getTable('application_processing_state');
    
                if (!$table->hasColumn('weights')) {
                    $table->addColumn('weights', 'json', ['notnull' => false]);
                }
    
                if (!$table->hasColumn('grade_adjustments')) {
                    $table->addColumn('grade_adjustments', 'json', ['notnull' => false]);
                }
            }
        }
    
        public function down(Schema $schema): void
        {
            if ($schema->hasTable('application_processing_state')) {
                $table = $schema->getTable('application_processing_state');
    
                if ($table->hasColumn('weights')) {
                    $table->dropColumn('weights');
                }
    
                if ($table->hasColumn('grade_adjustments')) {
                    $table->dropColumn('grade_adjustments');
                }
            }
        }
    }