laravel/framework · warning · RuntimeException

Database was not created. Aborting migration.

Error message

Database was not created. Aborting migration.

What it means

Thrown by MigrateCommand::createMissingSqliteDatabase() when, during a migration, the configured SQLite file does not exist and the user answers 'no' to the 'Would you like to create it?' confirm prompt (or the prompt is skipped under --no-interaction without --force). It aborts the migration rather than silently working on a non-existent file.

Source

Thrown at src/Illuminate/Database/Console/Migrations/MigrateCommand.php:226

     *
     * @throws \RuntimeException
     */
    protected function createMissingSqliteDatabase($path)
    {
        if ($this->option('force')) {
            return touch($path);
        }

        if ($this->option('no-interaction')) {
            return false;
        }

        $this->components->warn('The SQLite database configured for this application does not exist: '.$path);

        if (! confirm('Would you like to create it?', default: true)) {
            $this->components->info('Operation cancelled. No database was created.');

            throw new RuntimeException('Database was not created. Aborting migration.');
        }

        return touch($path);
    }

    /**
     * Create a missing MySQL or Postgres database.
     *
     * @param  \Illuminate\Database\Connection  $connection
     * @return bool
     *
     * @throws \RuntimeException
     */
    protected function createMissingMySqlOrPgsqlDatabase($connection)
    {
        if ($this->laravel['config']->get("database.connections.{$connection->getName()}.database") !== $connection->getDatabaseName()) {
            return false;
        }

View on GitHub (pinned to bd6b5437e6)

Solutions

  1. Pre-create the file before migrating: touch database/database.sqlite.
  2. Run with --force to auto-create: php artisan migrate --force.
  3. In CI, either ship the empty SQLite file or add a `touch`/migrate step with --force.
  4. Answer 'yes' to the interactive prompt when running locally.

Example fix

# before
php artisan migrate --no-interaction  # aborts

# after
touch database/database.sqlite
php artisan migrate --no-interaction
# or
php artisan migrate --force
Defensive patterns

Strategy: validation

Validate before calling

if (($path = config('database.connections.sqlite.database')) && $path !== ':memory:' && ! is_file($path)) {
    @touch($path);
}

Type guard

function sqliteFileReady(string $path): bool {
    return $path === ':memory:' || str_starts_with($path, 'file:') || is_file($path);
}

Prevention

When it happens

Trigger: Running `php artisan migrate` against a sqlite connection whose database file is missing, then declining the interactive prompt; or running with --no-interaction (and not --force), which short-circuits the prompt and returns false, aborting.

Common situations: CI/CD running `php artisan migrate --no-interaction` on a fresh checkout without the SQLite file present; a deploy where the artifact doesn't include the .sqlite file; locally deleting the file and re-running migrations.

Related errors


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