Skip to content
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

Add support for older rails versions #88

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions actual_db_schema.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion lib/actual_db_schema/migration_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading