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

7.0 rails update #67

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions lib/lazy_migrate/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ def run
loop do
catch(:done) do
on_done = -> { throw :done }
database_name = if ActiveRecord::Base.respond_to?(:connection_db_config)
ActiveRecord::Base.connection_db_config.database # Rails 7
else
ActiveRecord::Base.connection_config[:database] # Rails 6-
end

prompt.ok("\nDatabase: #{ActiveRecord::Base.connection_config[:database]}\n")

prompt.ok("\nDatabase: #{database_name}\n")
select_migration_prompt(on_done: on_done, migrator_adapter: migrator_adapter)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/lazy_migrate/migrator_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def replace_version_in_filename(filename, new_version)

sig { void }
def dump_schema
return if !ActiveRecord::Base.dump_schema_after_migration
return if !ActiveRecord.dump_schema_after_migration

# ripped from https://github.com/rails/rails/blob/5-1-stable/activerecord/lib/active_record/railties/databases.rake
filename = ENV["SCHEMA"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema.rb")
Expand Down