activerecord-import 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed6151dcefbe456505980e5f6a89898da893ee6e25ae4aeddc28aa0b1efe0765
4
- data.tar.gz: 381eb0b7b0910fc6900a73448728644e2e1d996e7744f9c8ff98d65ffefbaaf0
3
+ metadata.gz: f7cd19fa557186daf34db96db71f26a7db70b15e66a0a42eaab33be304945ab0
4
+ data.tar.gz: ff8afe763d437210ea1c78e21bacd0b4ae84f113fbadbda087077bf402f08e64
5
5
  SHA512:
6
- metadata.gz: '08492e9de01d21c6c8b5a12c8cd35c01b92040d148a7abc72a098405b10d0f1ae971ed2eb4185b8a2415a9bdb578452746f90aff5f57f50b4568082227a9dad4'
7
- data.tar.gz: 297a437db1f4098f716bc55c47b22346634677d3abf3706634ed7c2aecd74d959d356720d353f369e588bcba4b9f0c09db5ce444908b0e75c75353ebc74fa059
6
+ metadata.gz: 402d2087c8c35a2adfa3787ee4e183883df74cc1f4ad2276de1227ba9778b630bfbee546faa3b53b7dcbe1142232bd7d03de046ccab5c6caa5c475a3bc4f15c1
7
+ data.tar.gz: ef5ce7d4dba744b3c58a0affbe326b50d764c7e4c4726b468ad4d18eacee13fbaa8d7b5d78459bc048e8eeb0628cf34b52a59f759f0a1f4d9d491b7439d5845a
@@ -126,6 +126,7 @@ jobs:
126
126
  bundle exec rake test:mysql2_makara
127
127
  bundle exec rake test:mysql2spatial
128
128
  bundle exec rake test:mysql2_proxy
129
+ bundle exec rake test:janus_mysql2
129
130
  - name: Run tests with postgresql
130
131
  run: |
131
132
  bundle exec rake test:postgis
@@ -142,7 +143,10 @@ jobs:
142
143
  bundle exec rake test:sqlite3
143
144
  - name: Run trilogy tests
144
145
  if: ${{ matrix.env.AR_VERSION >= '7.0' && !startsWith(matrix.ruby, 'jruby') }}
145
- run: bundle exec rake test:trilogy
146
+ run: |
147
+ bundle exec rake test:trilogy
148
+ bundle exec rake test:janus_trilogy
149
+
146
150
  lint:
147
151
  runs-on: ubuntu-latest
148
152
  env:
data/.rubocop.yml CHANGED
@@ -15,9 +15,6 @@ Metrics/ClassLength:
15
15
  Metrics/CyclomaticComplexity:
16
16
  Enabled: false
17
17
 
18
- Metrics/LineLength:
19
- Enabled: false
20
-
21
18
  Metrics/MethodLength:
22
19
  Enabled: false
23
20
 
@@ -93,6 +90,9 @@ Layout/SpaceInsideParens:
93
90
  Layout/SpaceInsidePercentLiteralDelimiters:
94
91
  Enabled: false
95
92
 
93
+ Layout/LineLength:
94
+ Enabled: false
95
+
96
96
  Lint/ErbNewArguments:
97
97
  Enabled: false
98
98
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Changes in 2.2.0
2
+
3
+ ### New Features
4
+
5
+ * Add Support for Janus ActiveRecord adapters. Thanks to @permidon via #\873.
6
+
1
7
  ## Changes in 2.1.0
2
8
 
3
9
  ### New Features
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ ADAPTERS = %w(
20
20
  mysql2_makara
21
21
  mysql2spatial
22
22
  mysql2_proxy
23
+ janus_mysql2
23
24
  jdbcmysql
24
25
  jdbcsqlite3
25
26
  jdbcpostgresql
@@ -32,6 +33,7 @@ ADAPTERS = %w(
32
33
  spatialite
33
34
  seamless_database_pool
34
35
  trilogy
36
+ janus_trilogy
35
37
  ).freeze
36
38
  ADAPTERS.each do |adapter|
37
39
  namespace :test do
@@ -58,7 +58,7 @@ module ActiveRecord::Import::SQLite3Adapter
58
58
  sql = []
59
59
 
60
60
  # Options :recursive and :on_duplicate_key_ignore are mutually exclusive
61
- if supports_on_duplicate_key_update? && ((options[:ignore] || options[:on_duplicate_key_ignore]) && !options[:on_duplicate_key_update])
61
+ if supports_on_duplicate_key_update? && (options[:ignore] || options[:on_duplicate_key_ignore]) && !options[:on_duplicate_key_update]
62
62
  sql << sql_for_on_duplicate_key_ignore( options[:on_duplicate_key_ignore] )
63
63
  end
64
64
 
@@ -12,12 +12,14 @@ module ActiveRecord::Import
12
12
  when 'mysql2_makara' then 'mysql2'
13
13
  when 'mysql2spatial' then 'mysql2'
14
14
  when 'mysql2_proxy' then 'mysql2'
15
+ when 'janus_mysql2' then 'mysql2'
15
16
  when 'spatialite' then 'sqlite3'
16
17
  when 'postgresql_makara' then 'postgresql'
17
18
  when 'postgresql_proxy' then 'postgresql'
18
19
  when 'makara_postgis' then 'postgresql'
19
20
  when 'postgis' then 'postgresql'
20
21
  when 'cockroachdb' then 'postgresql'
22
+ when 'janus_trilogy' then 'trilogy'
21
23
  else adapter
22
24
  end
23
25
  end
@@ -559,7 +559,7 @@ class ActiveRecord::Base
559
559
  options[:primary_key] = primary_key
560
560
  options[:locking_column] = locking_column if locking_enabled?
561
561
 
562
- is_validating = options[:validate_with_context].present? ? true : options[:validate]
562
+ is_validating = options[:validate_with_context].present? || options[:validate]
563
563
  validator = ActiveRecord::Import::Validator.new(self, options)
564
564
 
565
565
  # assume array of model objects
@@ -1132,8 +1132,6 @@ When importing an array of hashes with provided columns_names, each hash must co
1132
1132
 
1133
1133
  Required keys: #{required_keys}
1134
1134
  Missing keys: #{missing_keys}
1135
-
1136
- Hash: #{hash}
1137
1135
  EOS
1138
1136
  else
1139
1137
  <<-EOS
@@ -1146,8 +1144,6 @@ for the missing keys or group these records into batches by key set before impor
1146
1144
  Required keys: #{required_keys}
1147
1145
  Extra keys: #{extra_keys}
1148
1146
  Missing keys: #{missing_keys}
1149
-
1150
- Hash: #{hash}
1151
1147
  EOS
1152
1148
  end
1153
1149
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Import
5
- VERSION = "2.1.0"
5
+ VERSION = "2.2.0"
6
6
  end
7
7
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ ENV["ARE_DB"] = "mysql2"
@@ -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
@@ -19,6 +19,9 @@ mysql2_makara:
19
19
  mysql2_proxy:
20
20
  <<: *mysql2
21
21
 
22
+ janus_mysql2:
23
+ <<: *mysql2
24
+
22
25
  postgresql: &postgresql
23
26
  <<: *common
24
27
  username: postgres
@@ -63,3 +66,8 @@ trilogy:
63
66
  <<: *common
64
67
  adapter: trilogy
65
68
  host: mysql
69
+
70
+ janus_trilogy:
71
+ <<: *common
72
+ adapter: trilogy
73
+ host: mysql
@@ -33,6 +33,9 @@ mysql2_makara:
33
33
  mysql2_proxy:
34
34
  <<: *mysql2
35
35
 
36
+ janus_mysql2:
37
+ <<: *mysql2
38
+
36
39
  oracle:
37
40
  <<: *common
38
41
  adapter: oracle
@@ -76,3 +79,7 @@ spatialite:
76
79
  trilogy:
77
80
  <<: *common
78
81
  adapter: trilogy
82
+
83
+ janus_trilogy:
84
+ <<: *common
85
+ adapter: trilogy
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+
5
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/assertions")
6
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")
7
+
8
+ should_support_mysql_import_functionality
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
4
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/assertions")
5
+ require File.expand_path("#{File.dirname(__FILE__)}/../support/mysql/import_examples")
6
+
7
+ should_support_mysql_import_functionality
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-03 00:00:00.000000000 Z
11
+ date: 2025-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -99,6 +99,8 @@ files:
99
99
  - lib/activerecord-import/synchronize.rb
100
100
  - lib/activerecord-import/value_sets_parser.rb
101
101
  - lib/activerecord-import/version.rb
102
+ - test/adapters/janus_mysql2.rb
103
+ - test/adapters/janus_trilogy.rb
102
104
  - test/adapters/jdbcmysql.rb
103
105
  - test/adapters/jdbcpostgresql.rb
104
106
  - test/adapters/jdbcsqlite3.rb
@@ -118,6 +120,8 @@ files:
118
120
  - test/database.yml.sample
119
121
  - test/github/database.yml
120
122
  - test/import_test.rb
123
+ - test/janus_mysql2/import_test.rb
124
+ - test/janus_trilogy/import_test.rb
121
125
  - test/jdbcmysql/import_test.rb
122
126
  - test/jdbcpostgresql/import_test.rb
123
127
  - test/jdbcsqlite3/import_test.rb
@@ -206,6 +210,8 @@ signing_key:
206
210
  specification_version: 4
207
211
  summary: Bulk insert extension for ActiveRecord
208
212
  test_files:
213
+ - test/adapters/janus_mysql2.rb
214
+ - test/adapters/janus_trilogy.rb
209
215
  - test/adapters/jdbcmysql.rb
210
216
  - test/adapters/jdbcpostgresql.rb
211
217
  - test/adapters/jdbcsqlite3.rb
@@ -225,6 +231,8 @@ test_files:
225
231
  - test/database.yml.sample
226
232
  - test/github/database.yml
227
233
  - test/import_test.rb
234
+ - test/janus_mysql2/import_test.rb
235
+ - test/janus_trilogy/import_test.rb
228
236
  - test/jdbcmysql/import_test.rb
229
237
  - test/jdbcpostgresql/import_test.rb
230
238
  - test/jdbcsqlite3/import_test.rb