Skip to content

Commit

Permalink
Improved adapter check
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 1, 2024
1 parent 39b06ba commit c96e0e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/strong_migrations/checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,19 @@ def version_safe?
end

def skip?
StrongMigrations.skip_databases.map(&:to_s).include?(connection.pool.db_config.name)
StrongMigrations.skip_databases.map(&:to_s).include?(db_config_name)
end

private

def check_adapter
return if defined?(@adapter_checked)

if adapter.instance_of?(Adapters::AbstractAdapter)
warn "[strong_migrations] Unsupported adapter: #{connection.adapter_name}. Use StrongMigrations.skip_databases to silence this warning."
warn "[strong_migrations] Unsupported adapter: #{connection.adapter_name}. Use StrongMigrations.skip_databases += #{[db_config_name.to_sym].inspect} to silence this warning."
end

@adapter_checked = true
end

def check_version_supported
Expand Down Expand Up @@ -213,6 +217,10 @@ def connection
@migration.connection
end

def db_config_name
connection.pool.db_config.name
end

def retry_lock_timeouts?(method)
(
StrongMigrations.lock_timeout_retries > 0 &&
Expand Down

0 comments on commit c96e0e4

Please sign in to comment.