The reference of this article is here.

Recently, I have needed to upgrade the old version of laravel project, but in the migrations, I found that the enum type is not supported with sqlite in unit testing.

Fortunately, I found the solution, here is the code:

class UpdateUserStatus extends Migration
{
    // if it doesn't set the type in sqlite, caused error;
    // [Doctrine\DBAL\DBALException]
    // Unknown database type enum requested, // Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
    Schema::table('users', function (Blueprint $table) {
        $table->enum('status', ['enabled', 'disabled'])->change();
    });
}

Firstly, you need to install dbal for v2.

"doctrine/dbal": "^2",
class UpdateUserStatus extends Migration
{
    public function __construct()
    {
        if (! Type::hasType('enum')) {
            Type::addType('enum', StringType::class);
        }

        DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
    }

Bouns, if you meet an error with foreign key, you can do below:

Schema::table('users', function (Blueprint $table) {
    if (DB::getDriverName() !== 'sqlite') {
        $table->dropForeign('user_role_id_foreign');
    }
});