Skip to content

Commit d3d3f8a

Browse files
authored
Merge pull request #887 from mateuscruz/add-trilogy-and-sqlite-proxy-adapters
Add support for trilogy and sqlite proxy adapters
2 parents 85da86e + 2828974 commit d3d3f8a

File tree

14 files changed

+84
-2
lines changed

14 files changed

+84
-2
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,12 @@ jobs:
161161
run: |
162162
bundle exec rake test:spatialite
163163
bundle exec rake test:sqlite3
164+
bundle exec rake test:sqlite3_proxy
164165
- name: Run trilogy tests
165166
if: ${{ matrix.env.AR_VERSION >= '7.0' && !startsWith(matrix.ruby, 'jruby') }}
166167
run: |
167168
bundle exec rake test:trilogy
169+
bundle exec rake test:trilogy_proxy
168170
bundle exec rake test:janus_trilogy
169171
170172
lint:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Unreleased
2+
3+
* Add Support for trilogy_proxy from [active_record_proxy_adapters](https://rubygems.org/gems/active_record_proxy_adapters) by @mateuscruz
4+
* Add Support for sqlite3_proxy from [active_record_proxy_adapters](https://rubygems.org/gems/active_record_proxy_adapters) by @mateuscruz
5+
16
## Changes in 2.2.0
27

38
### New Features

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ ADAPTERS = %w(
3030
postgis
3131
makara_postgis
3232
sqlite3
33+
sqlite3_proxy
3334
spatialite
3435
seamless_database_pool
3536
trilogy
37+
trilogy_proxy
3638
janus_trilogy
3739
).freeze
3840
ADAPTERS.each do |adapter|
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
require "active_record/connection_adapters/sqlite3_proxy_adapter"
4+
require "activerecord-import/adapters/sqlite3_proxy_adapter"
5+
6+
ActiveSupport.on_load(:active_record_sqlite3proxyadapter) do |klass|
7+
klass.include(ActiveRecord::Import::SQLite3ProxyAdapter)
8+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
require "active_record/connection_adapters/trilogy_proxy_adapter"
4+
require "activerecord-import/adapters/trilogy_proxy_adapter"
5+
6+
ActiveSupport.on_load(:active_record_trilogyproxyadapter) do |klass|
7+
klass.include(ActiveRecord::Import::TrilogyProxyAdapter)
8+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
require "activerecord-import/adapters/sqlite3_adapter"
4+
require "activerecord-import/adapters/active_record_proxy_adapter"
5+
6+
module ActiveRecord::Import::SQLite3ProxyAdapter
7+
include ActiveRecord::Import::SQLite3Adapter
8+
include ActiveRecord::Import::ActiveRecordProxyAdapter
9+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
require "activerecord-import/adapters/trilogy_adapter"
4+
require "activerecord-import/adapters/active_record_proxy_adapter"
5+
6+
module ActiveRecord::Import::TrilogyProxyAdapter
7+
include ActiveRecord::Import::TrilogyAdapter
8+
include ActiveRecord::Import::ActiveRecordProxyAdapter
9+
end

lib/activerecord-import/base.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ def self.base_adapter(adapter)
1111
case adapter
1212
when 'mysql2_makara' then 'mysql2'
1313
when 'mysql2spatial' then 'mysql2'
14-
when 'mysql2_proxy' then 'mysql2_proxy'
1514
when 'janus_mysql2' then 'mysql2'
1615
when 'spatialite' then 'sqlite3'
1716
when 'postgresql_makara' then 'postgresql'
18-
when 'postgresql_proxy' then'postgresql_proxy'
1917
when 'makara_postgis' then 'postgresql'
2018
when 'postgis' then 'postgresql'
2119
when 'cockroachdb' then 'postgresql'

test/adapters/sqlite3_proxy.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
ENV["ARE_DB"] = "sqlite3"

test/adapters/trilogy_proxy.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
require 'logger'
4+
5+
ENV["ARE_DB"] = "trilogy"
6+
7+
if ENV['AR_VERSION'].to_f <= 7.0
8+
require "activerecord-trilogy-adapter"
9+
require "trilogy_adapter/connection"
10+
ActiveRecord::Base.extend TrilogyAdapter::Connection
11+
end

0 commit comments

Comments
 (0)