Use connection.schema_version inside ActiveRecord::SchemaCache
AbstractAdapter#schema_version uses migration_context.current_version by default, but some adapters might redefine this method to use a custom schema version number. This fix ensures that generated schema cache files use this method and that it is also used when validating a file's version.
This commit is contained in:
parent
dda937fa62
commit
c4c28846e0
@ -130,7 +130,7 @@ def load_cache(connection)
|
||||
|
||||
if self.class.check_schema_cache_dump_version
|
||||
begin
|
||||
current_version = connection.migration_context.current_version
|
||||
current_version = connection.schema_version
|
||||
|
||||
if new_cache.version(connection) != current_version
|
||||
warn "Ignoring #{@cache_path} because it has expired. The current schema version is #{current_version}, but the one in the schema cache file is #{new_cache.schema_version}."
|
||||
@ -375,7 +375,7 @@ def database_version(connection) # :nodoc:
|
||||
end
|
||||
|
||||
def version(connection)
|
||||
@version ||= connection.migration_context.current_version
|
||||
@version ||= connection.schema_version
|
||||
end
|
||||
|
||||
def schema_version
|
||||
|
Loading…
Reference in New Issue
Block a user