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

Ignore `NoDatabaseError` when loading schema cache #31311

Merged
merged 1 commit into from Dec 3, 2017

Conversation

Projects
None yet
5 participants
@y-yagi
Copy link
Member

y-yagi commented Dec 2, 2017

When loading schema cache, fetch current migration version.
However, if database does not exist, connection acquisition will cause an error. This is a problem when create database.
When databas is not yet, schema cache is unnecessary, so fixed it to ignore errors.

Context: #31135 (comment)

@y-yagi

This comment has been minimized.

Copy link
Member Author

y-yagi commented Dec 2, 2017

cc @jeremy

@matthewd

This comment has been minimized.

Copy link
Member

matthewd commented Dec 2, 2017

I haven't thought this through, but I wonder if ActiveRecord::Migrator.current_version should just return nil if the database isn't there

@jeremy

This comment has been minimized.

Copy link
Member

jeremy commented Dec 2, 2017

Looks good to me. Agree that allowing ActiveRecord::Migrator.current_version to work without a current db makes sense, too.

Make `Migrator.current_version` work without a current database
This is necessary in order to make the processing dependent on
`Migrator.current_version` work even without database.

Context: #31135 (comment)

@y-yagi y-yagi force-pushed the y-yagi:ignore_no_database_error_when_loading_schema_cache branch to dbee80b Dec 3, 2017

@y-yagi

This comment has been minimized.

Copy link
Member Author

y-yagi commented Dec 3, 2017

Yeah, it makes sense. I changed to handle no database error with ActiveRecord::Migrator.current_version.

@kaspth kaspth merged commit dde620a into rails:master Dec 3, 2017

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bogdanvlviv

This comment has been minimized.

Copy link

bogdanvlviv commented on railties/test/isolation/abstract_unit.rb in dbee80b Apr 23, 2018

@y-yagi wouldn't it be the same if use sqlite3 instead of postgresql since on some environments it can't work without applying changes here(that isn't ok since it creates git-diff) because it doesn't rely on activerecord/test/config.yml ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment