laravel/framework · error · RuntimeException

This database driver does not support modifying columns.

Error message

This database driver does not support modifying columns.

What it means

Base Grammar::compileChange() throws RuntimeException because the driver's grammar does not support modifying existing columns. compileChange is invoked when a migration calls $column->change() (e.g. $table->string('name')->change()). Drivers that support it override compileChange; SQLite historically did so via a temp-table rebuild, MySQL/Postgres/SQL Server natively.

Source

Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:212

        return sprintf('alter table %s rename column %s to %s',
            $this->wrapTable($blueprint),
            $this->wrap($command->from),
            $this->wrap($command->to)
        );
    }

    /**
     * Compile a change column command into a series of SQL statements.
     *
     * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
     * @param  \Illuminate\Support\Fluent  $command
     * @return list<string>|string
     *
     * @throws \RuntimeException
     */
    public function compileChange(Blueprint $blueprint, Fluent $command)
    {
        throw new RuntimeException('This database driver does not support modifying columns.');
    }

    /**
     * Compile a fulltext index key command.
     *
     * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
     * @param  \Illuminate\Support\Fluent  $command
     * @return string
     *
     * @throws \RuntimeException
     */
    public function compileFulltext(Blueprint $blueprint, Fluent $command)
    {
        throw new RuntimeException('This database driver does not support fulltext index creation.');
    }

    /**
     * Compile a drop fulltext index command.

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Verify the connection is mysql/pgsql/sqlite/sqlsrv (all of which override compileChange in current Laravel).
  2. On a custom driver, implement compileChange to emit the engine's ALTER COLUMN/ALTER TABLE syntax.
  3. Rewrite the migration without ->change(): create a new column, backfill, drop old, rename.
  4. Ensure doctrine/dbal is installed if your Laravel version still relies on it for ->change().

Example fix

// before
Schema::table('users', fn (Blueprint $t) => $t->string('name', 100)->change());

// after — manual SQL for an unsupported driver
DB::statement('ALTER TABLE users MODIFY name VARCHAR(100)');
Defensive patterns

Strategy: type-guard

Validate before calling

$grammar = Schema::getConnection()->getSchemaGrammar();
if ((new \ReflectionMethod($grammar, 'compileChange'))->getDeclaringClass()->getName()
    === \Illuminate\Database\Schema\Grammars\Grammar::class) {
    throw new \RuntimeException('->change() unsupported on '.DB::connection()->getDriverName());
}
Schema::table('users', fn (Blueprint $t) => $t->string('name', 100)->change());

Type guard

function driverSupportsColumnChange(): bool
{
    $g = Schema::getConnection()->getSchemaGrammar();

    return (new \ReflectionMethod($g, 'compileChange'))
        ->getDeclaringClass()->getName() !== \Illuminate\Database\Schema\Grammars\Grammar::class;
}

Try / catch

try {
    Schema::table('users', fn (Blueprint $t) => $t->string('name', 100)->change());
} catch (\RuntimeException $e) {
    if (str_contains($e->getMessage(), 'modifying columns')) {
        DB::statement('ALTER TABLE users MODIFY name VARCHAR(100)');
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: Calling ->change() on a column inside a migration on a driver whose grammar does not override compileChange; combining the doctrine/dbal dependency removal (Laravel 11+) with an older driver that lacks native ->change() support.

Common situations: Pre-Laravel-9 apps that relied on doctrine/dbal for ->change() and dropped DBAL after upgrade; custom/obscure drivers missing the override.

Related errors


AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06). Data as JSON: /data/errors/4a25b402ed274bd4.json. Report an issue: GitHub.