-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Inconsistent behavior on db:prepare task #36383
Comments
@morgoth thanks for raising up this issue, I've been thinking about this and probably a |
The source of this issue is the same as the one for this one: #32914 The fact that For what its worth, on my approach to solve the above issue I used the Note: my PR doesn't solve this issue, but having the |
When SQLite connects it will silently create a database if the database does not exist. This behaviour causes different issues because of inconsistent behaviour between adapters: rails#36383, rails#32914. This commit adds a `database_exists?` method as a way to check the database without creating it. This is a stepping stone to fully resolving the above issues.
When SQLite connects it will silently create a database if the database does not exist. This behaviour causes different issues because of inconsistent behaviour between adapters: rails#36383, rails#32914. This commit adds a `database_exists?` method as a way to check the database without creating it. This is a stepping stone to fully resolving the above issues.
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
it's still an issue being worked on #36620 but got a little stale there ;) |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
The
db:prepare
task works different for PG adapter thanSQLite3
one.db:prepare
task introduced in #35768 in case of missing database is supposed to create it, load schema and seeds.This is working fine on PostgreSQL database, however when using SQLite3 database, seeds are not loaded.
This is happening, because
db:migrate
does not raiseActiveRecord::NoDatabaseError
whichdb:prepare
relies onrails/activerecord/lib/active_record/railties/databases.rake
Line 272 in eece0bf
Not sure what the proper fix would be. Raising
ActiveRecord::NoDatabaseError
on SQLite3 would be backward incompatible change, so maybe we should add some internal method for existence check of db, that could be used instead of relying on raising error?/cc @robertomiranda
The text was updated successfully, but these errors were encountered: