-
Notifications
You must be signed in to change notification settings - Fork 616
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
[Feature] Add trilogy adapter support #825
Changes from all commits
38061ee
5b97fd6
35e6ab5
7a27831
24ceeae
7109e15
ada6837
cf0abcb
fddcaa2
3a3a22f
d0611bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,20 @@ jobs: | |
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
mysql: | ||
image: mysql:5.7 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_USER: github | ||
MYSQL_PASSWORD: github | ||
MYSQL_DATABASE: activerecord_import_test | ||
options: >- | ||
--health-cmd "mysqladmin ping -h localhost" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -81,6 +95,7 @@ jobs: | |
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
rubygems: latest | ||
- name: Set up databases | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
|
@@ -110,6 +125,9 @@ jobs: | |
run: | | ||
bundle exec rake test:spatialite | ||
bundle exec rake test:sqlite3 | ||
- name: Run trilogy tests | ||
if: ${{ matrix.env.AR_VERSION >= '7.0' && matrix.ruby != 'jruby' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely sure where the trilogy gem stands with jruby, but I couldn't figure out a way to get it to successfully run. |
||
run: bundle exec rake test:trilogy | ||
lint: | ||
runs-on: ubuntu-latest | ||
env: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,10 @@ 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.0 | ||
if version >= 6.0 && version <= 7.0 | ||
gem "activerecord-trilogy-adapter" | ||
end | ||
Comment on lines
+29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding the integration of Trilogy, theoretically, it should seamlessly function with any framework equipped with the |
||
end | ||
|
||
platforms :jruby do | ||
|
@@ -37,7 +41,11 @@ platforms :jruby do | |
end | ||
|
||
# Support libs | ||
gem "factory_bot" | ||
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0") | ||
gem "factory_bot" | ||
else | ||
gem "factory_bot", "~> 5", "< 6.4.5" | ||
end | ||
Comment on lines
+44
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required due to the newest version of factory_bot requiring Ruby 3.0. |
||
gem "timecop" | ||
gem "chronic" | ||
gem "mocha", "~> 2.1.0" | ||
|
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 |
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
ENV["ARE_DB"] = "trilogy" | ||
|
||
if ENV['AR_VERSION'].to_f <= 7.0 | ||
require "activerecord-trilogy-adapter" | ||
require "trilogy_adapter/connection" | ||
ActiveRecord::Base.extend TrilogyAdapter::Connection | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,8 @@ sqlite3: &sqlite3 | |
|
||
spatialite: | ||
<<: *sqlite3 | ||
|
||
trilogy: | ||
<<: *common | ||
adapter: trilogy | ||
host: mysql |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,3 +66,7 @@ sqlite3: &sqlite3 | |
|
||
spatialite: | ||
<<: *sqlite3 | ||
|
||
trilogy: | ||
<<: *common | ||
adapter: trilogy |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this because this error was raised. This should ensure this type of error doesn't happen again.