This blog is part of our Rails 6.1 series.
In Rails 6.1, Rails will skip modifications to the test database if
SKIP_TEST_DATABASE is set to true.
> bundle exec rake db:create
Created database 'app_name_development'
Created database 'app_name_test'
> SKIP_TEST_DATABASE=true bundle exec rake db:create
Created database 'app_name_development'
As we can see in the first example, both a development and a test database
were created, which is unexpected when directly invoking db:create. One
obvious solution to this problem is to force the development environment to
only create a development database. However this solution will break
bin/setup as mentioned in
this commit.
Hence the need for an environment variable to skip test database creation.
Check out the pull request for more details.

Written bySandip Mane
Related blogs
- 01Rails 6.1 adds invert_where methodMay 4, 2021 · Chimed Palden
- 02Rails 6.1 adds in: option to validate numeric rangesApril 14, 2021 · Akanksha Jain
- 03Rails 6.1 adds delegated_type to ActiveRecordApril 6, 2021 · Akhil Gautam
- 04Rails 6.1 adds nulls_first and nulls_last to ArelMarch 9, 2021 · Berin Larson