From d0ccde567cd5604a6cd0418a86f2d3b6ce819938 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 13 Sep 2023 14:29:52 -0700 Subject: [PATCH] Added support for Trilogy - closes #276 --- CHANGELOG.md | 4 ++++ Gemfile | 1 + Rakefile | 2 +- gemfiles/activerecord61.gemfile | 1 + gemfiles/activerecord71.gemfile | 1 + lib/groupdate.rb | 2 +- test/adapters/trilogy.rb | 6 ++++++ 7 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 test/adapters/trilogy.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d163d162..232e79168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 6.4.0 (unreleased) + +- Added support for Trilogy + ## 6.3.0 (2023-07-02) - Dropped support for Ruby < 3 and Rails < 6.1 diff --git a/Gemfile b/Gemfile index a7155d054..7a117387c 100644 --- a/Gemfile +++ b/Gemfile @@ -7,5 +7,6 @@ gem "minitest" gem "activerecord", "~> 7.0.0" gem "pg" gem "mysql2" +gem "activerecord-trilogy-adapter" gem "sqlite3" gem "ruby-prof", require: false diff --git a/Rakefile b/Rakefile index 1a7820601..ac691f9b2 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ require "bundler/gem_tasks" require "rake/testtask" -ADAPTERS = %w(postgresql mysql sqlite enumerable redshift) +ADAPTERS = %w(postgresql mysql trilogy sqlite enumerable redshift) ADAPTERS.each do |adapter| namespace :test do diff --git a/gemfiles/activerecord61.gemfile b/gemfiles/activerecord61.gemfile index 19269b796..302a75629 100644 --- a/gemfiles/activerecord61.gemfile +++ b/gemfiles/activerecord61.gemfile @@ -7,4 +7,5 @@ gem "minitest" gem "activerecord", "~> 6.1.0" gem "pg" gem "mysql2" +gem "activerecord-trilogy-adapter" gem "sqlite3" diff --git a/gemfiles/activerecord71.gemfile b/gemfiles/activerecord71.gemfile index 4478fac06..cadd46497 100644 --- a/gemfiles/activerecord71.gemfile +++ b/gemfiles/activerecord71.gemfile @@ -7,4 +7,5 @@ gem "minitest" gem "activerecord", "7.1.0.beta1" gem "pg" gem "mysql2" +gem "trilogy" gem "sqlite3" diff --git a/lib/groupdate.rb b/lib/groupdate.rb index 9481ed85e..d4f83e69d 100644 --- a/lib/groupdate.rb +++ b/lib/groupdate.rb @@ -43,7 +43,7 @@ def self.register_adapter(name, adapter) end end -Groupdate.register_adapter ["Mysql2", "Mysql2Spatial", "Mysql2Rgeo"], Groupdate::Adapters::MySQLAdapter +Groupdate.register_adapter ["Mysql2", "Mysql2Spatial", "Mysql2Rgeo", "Trilogy"], Groupdate::Adapters::MySQLAdapter Groupdate.register_adapter ["PostgreSQL", "PostGIS", "Redshift"], Groupdate::Adapters::PostgreSQLAdapter Groupdate.register_adapter "SQLite", Groupdate::Adapters::SQLiteAdapter diff --git a/test/adapters/trilogy.rb b/test/adapters/trilogy.rb new file mode 100644 index 000000000..d61f18949 --- /dev/null +++ b/test/adapters/trilogy.rb @@ -0,0 +1,6 @@ +if ActiveRecord::VERSION::STRING.to_f < 7.1 + require "trilogy_adapter/connection" + ActiveRecord::Base.public_send :extend, TrilogyAdapter::Connection +end + +ActiveRecord::Base.establish_connection adapter: "trilogy", database: "groupdate_test"