laravel/framework · error · RuntimeException

This database driver does not support fulltext index…

Error message

This database driver does not support fulltext index creation.

What it means

Grammar::compileFulltext() throws RuntimeException on the base; ONLY PostgresGrammar overrides it. Notably the shipped MySQL/SQLite/SQL Server grammars inherit the throwing stub for compileFulltext. It compiles a fullText() index command emitted from a Blueprint.

Solutions

  1. Run fullText() migrations on Postgres, where compileFulltext is implemented.
  2. On MySQL, use the engine's native FULLTEXT KEY via raw SQL (DB::statement) instead of the Blueprint fullText() command, since this codebase's MySqlGrammar does not override compileFulltext.
  3. In tests on SQLite, skip the fullText() call conditionally.

Example fix

// before - throws on MySQL/SQLite/SQL Server
Schema::create('posts', function (Blueprint $t) {
    $t->id();
    $t->string('title');
    $t->text('body');
    $t->fullText(['title', 'body']);
});

// after - only on Postgres
Schema::create('posts', function (Blueprint $t) {
    $t->id();
    $t->string('title');
    $t->text('body');
    if (config('database.default') === 'pgsql') {
        $t->fullText(['title', 'body']);
    }
});
Defensive patterns

Strategy: validation

Validate before calling

use Illuminate\Database\PostgresConnection;

if (Schema::getConnection() instanceof PostgresConnection) {
    // safe to call fullText()
} else {
    throw new \DomainException('Blueprint fullText() is implemented only for Postgres in this codebase.');
}

Type guard

use Illuminate\Database\PostgresConnection;

function supportsBlueprintFullText(\Illuminate\Database\Connection $connection): bool
{
    return $connection instanceof PostgresConnection;
}

Try / catch

try {
    Schema::table('posts', fn ($t) => $t->fullText(['title', 'body']));
} catch (\RuntimeException $e) {
    if (str_contains($e->getMessage(), 'fulltext index creation')) {
        DB::statement('ALTER TABLE posts ADD FULLTEXT INDEX ft_title_body (title, body)'); // MySQL native
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: Defining $table->fullText(['title', 'body']) in a migration running against MySQL, SQLite, or SQL Server - i.e. any non-Postgres supported driver. The Blueprint emits a fulltext command, the grammar cannot compile it, and the migration fails.

Common situations: Migrating a Postgres full-text-search schema onto MySQL (where fulltext historically uses a different code path) or SQLite for testing; assuming fullText() works the same on every engine.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/9048ec3e1a2315d5. Report an issue: GitHub.

Appendix: source

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

     * @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.
     *
     * @param  \Illuminate\Database\Schema\Blueprint  $blueprint
     * @param  \Illuminate\Support\Fluent  $command
     * @return string
     *
     * @throws \RuntimeException
     */
    public function compileDropFullText(Blueprint $blueprint, Fluent $command)
    {
        throw new RuntimeException('This database driver does not support fulltext index removal.');
    }

    /**
     * Compile a foreign key command.

View on GitHub (pinned to e0f6eb3518)