Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add trilogy adapter #811

Closed
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
bundle exec rake test:mysql2
bundle exec rake test:mysql2_makara
bundle exec rake test:mysql2spatial
bundle exec rake test:trilogy
- name: Run tests with postgresql
run: |
bundle exec rake test:postgis
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ platforms :ruby do
gem "sqlite3", "~> #{sqlite3_version}"
# seamless_database_pool requires Ruby ~> 2.0
gem "seamless_database_pool", "~> 1.0.20" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
gem "trilogy" if version >= 6.1
gem "activerecord-trilogy-adapter" if version >= 6.1
end

platforms :jruby do
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ADAPTERS = %w(
sqlite3
spatialite
seamless_database_pool
trilogy
).freeze
ADAPTERS.each do |adapter|
namespace :test do
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require "active_record/connection_adapters/trilogy_adapter"
require "activerecord-import/adapters/trilogy_adapter"

class ActiveRecord::ConnectionAdapters::TrilogyAdapter
include ActiveRecord::Import::TrilogyAdapter
end
7 changes: 7 additions & 0 deletions lib/activerecord-import/adapters/trilogy_adapter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require "activerecord-import/adapters/mysql_adapter"

module ActiveRecord::Import::TrilogyAdapter
include ActiveRecord::Import::MysqlAdapter
end
8 changes: 8 additions & 0 deletions test/adapters/trilogy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# ensure we connect to the trilogy adapter
require "activerecord-trilogy-adapter"
require "trilogy_adapter/connection"
ActiveRecord::Base.extend TrilogyAdapter::Connection

ENV["ARE_DB"] = "trilogy"
5 changes: 5 additions & 0 deletions test/database.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ sqlite3: &sqlite3

spatialite:
<<: *sqlite3

trilogy:
<<: *common
adapter: trilogy
host: mysql
4 changes: 4 additions & 0 deletions test/github/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ sqlite3: &sqlite3

spatialite:
<<: *sqlite3

trilogy:
<<: *common
adapter: trilogy
7 changes: 7 additions & 0 deletions test/trilogy/import_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
require File.expand_path("#{File.dirname(__FILE__)}/../support/assertions")
require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")

should_support_mysql_import_functionality