A Laravel migration fails because Doctrine DBAL is missing
php artisan migrate stops with a class not found error that names a Doctrine\DBAL classShort answer
Before Laravel 11, changing, renaming or dropping some columns needed the doctrine/dbal package. If a migration with change() fails on a missing Doctrine class, run composer require doctrine/dbal on Laravel 10 or older. Laravel 11 and newer no longer depend on it, so leftover DBAL code is the thing to remove.
Fix it fast
1Find out which cause you have
Find the Laravel version first. The fix is different on either side of version 11.
php artisan --version composer show doctrine/dbal2Match what you see, then jump to its fix
- 1
The failing migration calls ->change() or renameColumn(), and Laravel is below 11Laravel 10 or older needs doctrine/dbal to modify columnsFix - 2
Laravel is 11 or newer, and the stack trace points to your own code, a config entry or an old package that touches DBALLaravel 11 or newer: code still expects Doctrine DBALFix
- 1
What does the error look like?
php artisan migrate stops with a class not found error that names a Doctrine\DBAL classThe failing migration calls change() or renameColumn()
Cause 1 of 2
Laravel 10 or older needs doctrine/dbal to modify columns
1Check
The Laravel 10 migrations docs say doctrine/dbal must be installed before modifying a column on SQLite, and before renaming a column on older databases (MySQL below 8.0.3, MariaDB below 10.5.2, SQLite below 3.25.0).
php artisan --version
grep -rn "change()\|renameColumn" database/migrations | tail -n 52Fix
Install the package with Composer and run the migration again.
composer require doctrine/dbal
php artisan migrate3Verify
The migration runs and the column has its new definition.
php artisan migrate:statusConfirmed by raw.githubusercontent.com
Cause 2 of 2
Laravel 11 or newer: code still expects Doctrine DBAL
1Check
The Laravel 11 upgrade guide says the framework no longer depends on Doctrine DBAL, and lists removed methods such as getDoctrineConnection() and registerDoctrineType().
grep -rn "Doctrine\|getDoctrineConnection\|registerDoctrineType" app/ database/ config/2Fix
Delete the dbal.types registration from the database config and replace table inspection with Laravel's own Schema methods. The guide says the doctrine/dbal dependency can be removed if you added it.
use Illuminate\Support\Facades\Schema;
Schema::getColumns('users');
Schema::getIndexes('users');
Schema::getForeignKeys('users');
// then: composer remove doctrine/dbal3Verify
Run the migrations from a clean database.
php artisan migrate:freshConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Note the Laravel version in the project README, so people pick the right fix.
- Run migrations in CI against a fresh database on every pull request.
- When upgrading to Laravel 11 or newer, follow the upgrade guide's DBAL section and remove the leftover code.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix