Skip to content

Commit 7846ca1

Browse files
committed
Added support for Trilogy
1 parent c26c4d3 commit 7846ca1

File tree

6 files changed

+26
-2
lines changed

6 files changed

+26
-2
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
gemfile: gemfiles/mysql2.gemfile
2525
adapter: mysql2
2626
mysql: true
27+
- ruby: 3.1
28+
gemfile: gemfiles/trilogy.gemfile
29+
adapter: trilogy
30+
mysql: true
2731
- ruby: 3.1
2832
gemfile: gemfiles/mongoid8.gemfile
2933
mongodb: true

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.1 (unreleased)
2+
3+
- Added support for Trilogy
4+
15
## 0.4.0 (2023-05-25)
26

37
- Fixed error with Active Record 7.0.5

gemfiles/trilogy.gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source "https://rubygems.org"
2+
3+
gemspec path: ".."
4+
5+
gem "activerecord", "~> 7.0.0"
6+
gem "minitest"
7+
gem "activerecord-trilogy-adapter"
8+
gem "rake"
9+
gem "groupdate", github: "ankane/groupdate"

lib/active_median/model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def calculate_percentile(column, percentile, operation)
5151

5252
relation =
5353
case connection.adapter_name
54-
when /mysql/i
54+
when /mysql/i, /trilogy/i
5555
# assume mariadb by default
5656
# use send as this method is private in Rails 4.2
5757
mariadb = connection.send(:mariadb?) rescue true

test/median_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def test_groupdate
150150

151151
def test_non_numeric
152152
# TODO debug mysql
153-
skip if adapter == "mysql2" || mongoid?
153+
skip if adapter == "mysql2" || adapter == "trilogy" || mongoid?
154154

155155
User.create!(name: 'A')
156156
assert_raises(ActiveRecord::StatementInvalid) do

test/support/active_record.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
ActiveRecord::Base.establish_connection "sqlserver://SA:YourStrong!Passw0rd@localhost:1433/active_median_test"
77
elsif adapter == "redshift"
88
ActiveRecord::Base.establish_connection ENV["DATABASE_URL"]
9+
elsif adapter == "trilogy"
10+
if ActiveRecord::VERSION::STRING.to_f < 7.1
11+
require "trilogy_adapter/connection"
12+
ActiveRecord::Base.public_send :extend, TrilogyAdapter::Connection
13+
end
14+
15+
ActiveRecord::Base.establish_connection adapter: adapter, database: "active_median_test", host: "127.0.0.1"
916
else
1017
ActiveRecord::Base.establish_connection adapter: adapter, database: sqlite? ? ":memory:" : "active_median_test"
1118
end

0 commit comments

Comments
 (0)