Skip to content

Commit

Permalink
Added support for Trilogy
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 14, 2023
1 parent dcebcf5 commit 88fd1ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.6.3 (unreleased)

- Added support for Trilogy

## 1.6.2 (2023-09-13)

- Fixed foreign key options with `add_reference` and `safe_by_default`
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gem "minitest", ">= 5"
gem "activerecord", "~> 7.0.0"
gem "pg"
gem "mysql2"
gem "activerecord-trilogy-adapter"
2 changes: 1 addition & 1 deletion lib/strong_migrations/checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def adapter
case connection.adapter_name
when /postg/i # PostgreSQL, PostGIS
Adapters::PostgreSQLAdapter
when /mysql/i
when /mysql|trilogy/i
if connection.try(:mariadb?)
Adapters::MariaDBAdapter
else
Expand Down
10 changes: 8 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ def self.env
if ActiveRecord::VERSION::STRING.to_f >= 7.1
connection_options[:prepared_statements] = true
end
elsif $adapter == "trilogy"
if ActiveRecord::VERSION::STRING.to_f < 7.1
require "trilogy_adapter/connection"
ActiveRecord::Base.public_send :extend, TrilogyAdapter::Connection
end
connection_options[:host] = "127.0.0.1"
end
ActiveRecord::Base.establish_connection(**connection_options)

Expand Down Expand Up @@ -91,11 +97,11 @@ def postgresql?
end

def mysql?
$adapter == "mysql2" && !ActiveRecord::Base.connection.mariadb?
($adapter == "mysql2" || $adapter == "trilogy") && !ActiveRecord::Base.connection.mariadb?
end

def mariadb?
$adapter == "mysql2" && ActiveRecord::Base.connection.mariadb?
($adapter == "mysql2" || $adapter == "trilogy") && ActiveRecord::Base.connection.mariadb?
end
end

Expand Down

0 comments on commit 88fd1ac

Please sign in to comment.