Skip to content

hotfix: replace ->change() with raw ALTER TABLE in nullable migration#230

Merged
roncodes merged 5 commits intomainfrom
hotfix/orchestrator-priority-nullable-migration
Apr 20, 2026
Merged

hotfix: replace ->change() with raw ALTER TABLE in nullable migration#230
roncodes merged 5 commits intomainfrom
hotfix/orchestrator-priority-nullable-migration

Conversation

@roncodes
Copy link
Copy Markdown
Member

Problem

The migration 2026_04_20_000001_make_orchestrator_priority_nullable_on_orders_table shipped in the previous PR crashes on deployment with:

Unknown column type "tinyinteger" requested. Any Doctrine type that you use
has to be registered with \Doctrine\DBAL\Types\Type::addType().

Root Cause

Blueprint::change() delegates to Doctrine DBAL to introspect the existing column definition before rewriting it. Doctrine does not have a registered type mapping for MySQL's native TINYINT, so it throws the tinyinteger error when it tries to describe the column.

Fix

Replace the Blueprint::change() call with a raw DB::statement() ALTER TABLE that modifies the column directly:

// Before (broken)
Schema::table('orders', function (Blueprint $table) {
    $table->unsignedTinyInteger('orchestrator_priority')
          ->default(50)->nullable()->change();
});

// After (fixed)
DB::statement(
    'ALTER TABLE `orders` MODIFY COLUMN `orchestrator_priority` TINYINT UNSIGNED NULL DEFAULT 50'
);

This is fully portable across all MySQL/MariaDB versions supported by Fleetbase and has no dependency on Doctrine DBAL type mappings. The down() method is updated identically.

Files Changed

File Change
server/migrations/2026_04_20_000001_make_orchestrator_priority_nullable_on_orders_table.php Replaced Schema::table()->change() with DB::statement(ALTER TABLE …) in both up() and down()

shivthakker and others added 5 commits April 20, 2026 06:17
The previous migration used:

    $table->unsignedTinyInteger('orchestrator_priority')
          ->default(50)->nullable()->change();

->change() delegates to Doctrine DBAL to introspect the existing column
type before rewriting it.  Doctrine does not have a registered mapping for
MySQL's TINYINT, so it throws:

  Unknown column type "tinyinteger" requested. Any Doctrine type that
  you use has to be registered with Doctrine\DBAL\Types\Type::addType().

Fix: replace the Blueprint::change() call with a raw DB::statement()
ALTER TABLE that modifies the column directly.  This is fully portable
across all MySQL/MariaDB versions supported by Fleetbase and has no
dependency on Doctrine DBAL type mappings.
feat(i18n): Add Spanish (Panama) translation [es-pa]
@roncodes roncodes merged commit 75db3b2 into main Apr 20, 2026
4 checks passed
@roncodes roncodes deleted the hotfix/orchestrator-priority-nullable-migration branch April 20, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants