-
Notifications
You must be signed in to change notification settings - Fork 21.8k
Be more explicit about the default of db:drop and db:create #13629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dmathieu Can also add this to |
You're right. Thank you. 🌞 |
@@ -12,7 +12,7 @@ db_namespace = namespace :db do | |||
end | |||
end | |||
|
|||
desc 'Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all databases in the config)' | |||
desc 'Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all databases in the config). Defaults to creating the development and test databases' | |||
task :create => [:load_config] do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmathieu I think it can be better worded by
Defaults to creating the development and test databases in absence of Rails.env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There never is an absence of Rails.env
. It defaults to development
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Yes you are right :)
@dmathieu Will it work with |
From the description it's not obvious to me, when the default applies and how I can change it to only create the database of the current |
Looking closer I think we should also change the functionality. Currently:
I think if the
This explains when the default is active and how it can be changed. |
This is even worse when using
|
@senny: your idea definitely makes sense. ⭐ |
@@ -201,7 +201,7 @@ def class_for_adapter(adapter) | |||
|
|||
def each_current_configuration(environment) | |||
environments = [environment] | |||
environments << 'test' if environment == 'development' | |||
environments << 'test' if environment == 'development' && ENV['RAILS_ENV'].nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quite hidden. Let's at least add a comment why that check is there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Be more explicit about the default of db:drop and db:create
@dmathieu thanks 💛 |
Closes #13625