laravelphpunitlaravel-10doctrine-dbal

Error: Call to undefined method Doctrine\DBAL\Schema\SqliteSchemaManager::introspectTable()


In a Laravel project after I upgraded to Laravel 10, PHPUnit 10, etc. I get this error when I try to run PHPUnit:

Error: Call to undefined method Doctrine\DBAL\Schema\SqliteSchemaManager::introspectTable()

/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php:60
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php:39
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Grammars/Grammar.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:136
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:109
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:439
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:269
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:353
/var/www/html/database/migrations/2021_11_17_154600_alter_table_modify_content_column_type.php:16
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:492
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:410
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:419
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:216
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php:37
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:755
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:216
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:181
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:124
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:88
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:632
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:81
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:662
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:194
/var/www/html/vendor/symfony/console/Command/Command.php:312
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:163
/var/www/html/vendor/symfony/console/Application.php:1022
/var/www/html/vendor/symfony/console/Application.php:314
/var/www/html/vendor/symfony/console/Application.php:168
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php:162
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:381
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:296
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:481
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:80
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:47
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:22
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:125
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:94
/var/www/html/tests/MultitenancyTestCase.php:39

The content of the referred 2021_11_17_154600_alter_table_modify_content_column_type.php file is this:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('menu_contents', function (Blueprint $table) { // <-- 16. line
            $table->mediumText('content')->change();
        });
        // ...

Should I install or upgrade something? How can I solve this issue?


Solution

  • There might be version issue with DBAL. We can try using below line of code in composer to maintain previous version as well.

    "doctrine/dbal": "~3.5 || ~3.6.2",