diff --git a/Gemfile.lock b/Gemfile.lock index 83768aa..47997ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: actual_db_schema (0.7.6) - activerecord (>= 6.0.0) - activesupport (>= 6.0.0) + activerecord + activesupport csv GEM diff --git a/actual_db_schema.gemspec b/actual_db_schema.gemspec index 4a49412..d742099 100644 --- a/actual_db_schema.gemspec +++ b/actual_db_schema.gemspec @@ -35,8 +35,8 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] # Uncomment to register a new dependency of your gem - spec.add_runtime_dependency "activerecord", ">= 6.0.0" - spec.add_runtime_dependency "activesupport", ">= 6.0.0" + spec.add_runtime_dependency "activerecord" + spec.add_runtime_dependency "activesupport" spec.add_runtime_dependency "csv" spec.add_development_dependency "appraisal" diff --git a/lib/actual_db_schema/migration_context.rb b/lib/actual_db_schema/migration_context.rb index dd5fd01..338efb6 100644 --- a/lib/actual_db_schema/migration_context.rb +++ b/lib/actual_db_schema/migration_context.rb @@ -20,7 +20,12 @@ def establish_connection(db_config) end def configs - ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env) + # Rails < 6.0 has a Hash in configurations + if ActiveRecord::Base.configurations.is_a?(Hash) + [ActiveRecord::Base.configurations[ActiveRecord::Tasks::DatabaseTasks.env]] + else + ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env) + end end def context