rails: db:create:all task fails for new app with mysql adapter
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
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- Fix `rails db:create:all` to not touch databases before they are created Fixes #50038. — committed to fatkodima/rails by fatkodima 3 years ago
- Fix `rails db:create:all` to not touch databases before they are created Fixes #50038. — committed to fatkodima/rails by fatkodima 3 years ago
- Fix `rails db:create:all` to not touch databases before they are created Fixes #50038. — committed to fatkodima/rails by fatkodima 3 years ago
- Fix CI for Rails 7.1.3 `rake db:create:all` still isn't fixed (see [1]). Adapt template so that we no longer need the development database. [1] https://github.com/rails/rails/issues/50038 — committed to tf/pageflow by tf 3 years ago
- Fix dummy app setup for Rails 7.1.3 `rake db:create:all` still isn't fixed (see [1]). Adapt template so that we no longer need the development database. [1] https://github.com/rails/rails/issues/500... — committed to codevise/pageflow by tf 3 years ago
- chore: Update Rails 7.1.x version to 7.1.3 It looks like the Rails 7.1.3 version has a bug on the `db:create:all` task, see this issue for more details: https://github.com/rails/rails/issues/50038 ... — committed to thoughtbot/shoulda-matchers by matsales28 3 years ago
- chore: Update dependencies (#1611) * chore: Update base dependencies * chore: Update Rails 7.1.x version to 7.1.3 It looks like the Rails 7.1.3 version has a bug on the `db:create:all` task, s... — committed to thoughtbot/shoulda-matchers by matsales28 3 years ago
Was able to reproduce and find a fix. Going to open a PR.