Skip to content

Commit

Permalink
Added warning for unsupported adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 1, 2024
1 parent a9216eb commit 39b06ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.1.0 (unreleased)

- Added `skip_databases` option
- Added warning for unsupported adapters

## 2.0.2 (2024-10-30)

Expand Down
2 changes: 0 additions & 2 deletions lib/strong_migrations/adapters/abstract_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ def min_version
end

def set_statement_timeout(timeout)
raise StrongMigrations::Error, "Statement timeout not supported for this database"
end

def set_lock_timeout(timeout)
raise StrongMigrations::Error, "Lock timeout not supported for this database"
end

def check_lock_timeout(limit)
Expand Down
7 changes: 7 additions & 0 deletions lib/strong_migrations/checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def self.safety_assured
def perform(method, *args)
return yield if skip?

check_adapter
check_version_supported
set_timeouts
check_lock_timeout
Expand Down Expand Up @@ -137,6 +138,12 @@ def skip?

private

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

def check_version_supported
return if defined?(@version_checked)

Expand Down

0 comments on commit 39b06ba

Please sign in to comment.