Skip to content

db:create:all task fails for new app with mysql adapter #50038

@tf

Description

@tf

Steps to reproduce

rails new foo -d mysql
cd ./foo
edit config/database.yml # Enter root password
bin/rails db:create:all

Expected behavior

Databases are being created.

Actual behavior

Error:

ActiveRecord::NoDatabaseError: We could not find your database: foo_development. Available database configurations can be found in config/database.yml file. (ActiveRecord::NoDatabaseError)

To resolve this error:

- Did you create the database for this app, or delete it? You may need to create your database.
- Has the database name changed? Check your database.yml config has the correct database name.

To create your database, run:

        bin/rails db:create

After calling bin/rails db:create, bin/rails db:create:all works as expected.

I am aware that db:create now also creates the test database in the development env. I'm using the db:create:all task, though, to automatically create databases for a dummy application of a Rails engine, where db:create still only creates the test database when running in CI.

System configuration

Rails version: 7.1.2 - 7.1.3

Ruby version: 3.2.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions