Skip to content

Commit

Permalink
Merge pull request #90 from hirocaster/support-trilogy
Browse files Browse the repository at this point in the history
Add support trilogy adapter
  • Loading branch information
amatsuda authored Jul 10, 2024
2 parents 3e82a16 + 364f935 commit f244b3d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ jobs:
fail-fast: false

matrix:
db: [sqlite3, postgresql, mysql]
db: [sqlite3, postgresql, mysql, trilogy]
ruby_version: [ruby-head, '3.3', '3.2', '3.1']
rails_version: [edge, '7.1', '7.0', '6.1']

exclude:
- ruby_version: ruby-head
rails_version: '6.1'
- rails_version: '7.0'
db: trilogy
- rails_version: '6.1'
db: trilogy

include:
- ruby_version: '3.0'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ when 'mysql'
else
gem 'mysql2'
end
when 'trilogy'
gem 'trilogy'
else
if rails_version <= '5.0'
gem 'sqlite3', '< 1.4'
Expand Down
2 changes: 1 addition & 1 deletion lib/database_rewinder/active_record_monkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module DatabaseRewinder
module InsertRecorder
# This method actually no longer has to be a `prepended` hook because InsertRecorder is a module without a direct method now, but still doing this just for compatibility
def self.prepended(mod)
[:execute, :exec_query, :internal_exec_query].each do |method_name|
[:execute, :exec_insert, :exec_query, :internal_exec_query].each do |method_name|
if mod.instance_methods.include?(method_name) && (meth = mod.instance_method(method_name))
method_body = if meth.parameters.any? {|type, _name| [:key, :keyreq, :keyrest].include? type }
<<-RUBY
Expand Down
15 changes: 15 additions & 0 deletions test/config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ test2:
password:
database: database_rewinder_test2

<% when 'trilogy' %>
test:
adapter: trilogy
host: 127.0.0.1
username: root
password:
database: database_rewinder_test

test2:
adapter: trilogy
host: 127.0.0.1
username: root
password:
database: database_rewinder_test2

<% when 'postgresql' %>
superuser_connection:
adapter: postgresql
Expand Down

0 comments on commit f244b3d

Please sign in to comment.