activerecord-import 1.3.0 → 1.4.1
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 +4 -4
- data/.github/workflows/test.yaml +39 -10
- data/.rubocop.yml +74 -8
- data/Brewfile +3 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile +5 -7
- data/README.markdown +9 -8
- data/Rakefile +2 -0
- data/activerecord-import.gemspec +2 -1
- data/benchmarks/benchmark.rb +7 -1
- data/benchmarks/lib/base.rb +2 -0
- data/benchmarks/lib/cli_parser.rb +3 -1
- data/benchmarks/lib/float.rb +2 -0
- data/benchmarks/lib/mysql2_benchmark.rb +2 -0
- data/benchmarks/lib/output_to_csv.rb +2 -0
- data/benchmarks/lib/output_to_html.rb +4 -2
- data/benchmarks/models/test_innodb.rb +2 -0
- data/benchmarks/models/test_memory.rb +2 -0
- data/benchmarks/models/test_myisam.rb +2 -0
- data/benchmarks/schema/mysql2_schema.rb +2 -0
- data/gemfiles/4.2.gemfile +2 -0
- data/gemfiles/5.0.gemfile +2 -0
- data/gemfiles/5.1.gemfile +2 -0
- data/gemfiles/5.2.gemfile +2 -0
- data/gemfiles/6.0.gemfile +2 -0
- data/gemfiles/6.1.gemfile +2 -0
- data/gemfiles/7.0.gemfile +4 -1
- data/lib/activerecord-import/active_record/adapters/abstract_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/mysql2_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/postgresql_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb +2 -0
- data/lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb +2 -0
- data/lib/activerecord-import/adapters/abstract_adapter.rb +2 -0
- data/lib/activerecord-import/adapters/em_mysql2_adapter.rb +2 -0
- data/lib/activerecord-import/adapters/mysql2_adapter.rb +2 -0
- data/lib/activerecord-import/adapters/mysql_adapter.rb +3 -1
- data/lib/activerecord-import/adapters/postgresql_adapter.rb +41 -28
- data/lib/activerecord-import/adapters/sqlite3_adapter.rb +8 -6
- data/lib/activerecord-import/base.rb +3 -1
- data/lib/activerecord-import/import.rb +21 -10
- data/lib/activerecord-import/mysql2.rb +2 -0
- data/lib/activerecord-import/postgresql.rb +2 -0
- data/lib/activerecord-import/sqlite3.rb +2 -0
- data/lib/activerecord-import/synchronize.rb +2 -0
- data/lib/activerecord-import/value_sets_parser.rb +2 -0
- data/lib/activerecord-import/version.rb +3 -1
- data/lib/activerecord-import.rb +3 -1
- data/test/adapters/jdbcmysql.rb +2 -0
- data/test/adapters/jdbcpostgresql.rb +2 -0
- data/test/adapters/jdbcsqlite3.rb +2 -0
- data/test/adapters/makara_postgis.rb +2 -0
- data/test/adapters/mysql2.rb +2 -0
- data/test/adapters/mysql2_makara.rb +2 -0
- data/test/adapters/mysql2spatial.rb +2 -0
- data/test/adapters/postgis.rb +2 -0
- data/test/adapters/postgresql.rb +2 -0
- data/test/adapters/postgresql_makara.rb +2 -0
- data/test/adapters/seamless_database_pool.rb +2 -0
- data/test/adapters/spatialite.rb +2 -0
- data/test/adapters/sqlite3.rb +2 -0
- data/test/import_test.rb +26 -1
- data/test/jdbcmysql/import_test.rb +2 -0
- data/test/jdbcpostgresql/import_test.rb +2 -0
- data/test/jdbcsqlite3/import_test.rb +2 -0
- data/test/makara_postgis/import_test.rb +2 -0
- data/test/models/account.rb +2 -0
- data/test/models/alarm.rb +2 -0
- data/test/models/animal.rb +2 -0
- data/test/models/bike_maker.rb +2 -0
- data/test/models/book.rb +2 -0
- data/test/models/car.rb +2 -0
- data/test/models/card.rb +2 -0
- data/test/models/chapter.rb +2 -0
- data/test/models/customer.rb +2 -0
- data/test/models/deck.rb +2 -0
- data/test/models/dictionary.rb +2 -0
- data/test/models/discount.rb +2 -0
- data/test/models/end_note.rb +2 -0
- data/test/models/group.rb +2 -0
- data/test/models/order.rb +2 -0
- data/test/models/playing_card.rb +2 -0
- data/test/models/promotion.rb +2 -0
- data/test/models/question.rb +2 -0
- data/test/models/rule.rb +2 -0
- data/test/models/tag.rb +3 -0
- data/test/models/tag_alias.rb +5 -0
- data/test/models/topic.rb +2 -0
- data/test/models/user.rb +2 -0
- data/test/models/user_token.rb +2 -0
- data/test/models/vendor.rb +2 -0
- data/test/models/widget.rb +2 -0
- data/test/mysql2/import_test.rb +2 -0
- data/test/mysql2_makara/import_test.rb +2 -0
- data/test/mysqlspatial2/import_test.rb +2 -0
- data/test/postgis/import_test.rb +2 -0
- data/test/postgresql/import_test.rb +2 -0
- data/test/schema/generic_schema.rb +8 -0
- data/test/schema/jdbcpostgresql_schema.rb +2 -0
- data/test/schema/mysql2_schema.rb +2 -0
- data/test/schema/postgis_schema.rb +2 -0
- data/test/schema/postgresql_schema.rb +2 -0
- data/test/schema/sqlite3_schema.rb +2 -0
- data/test/schema/version.rb +2 -0
- data/test/sqlite3/import_test.rb +2 -0
- data/test/support/active_support/test_case_extensions.rb +2 -0
- data/test/support/assertions.rb +2 -0
- data/test/support/factories.rb +2 -0
- data/test/support/generate.rb +4 -2
- data/test/support/mysql/import_examples.rb +2 -1
- data/test/support/postgresql/import_examples.rb +41 -2
- data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
- data/test/support/shared_examples/on_duplicate_key_update.rb +2 -0
- data/test/support/shared_examples/recursive_import.rb +2 -0
- data/test/support/sqlite3/import_examples.rb +2 -1
- data/test/synchronize_test.rb +2 -0
- data/test/test_helper.rb +18 -2
- data/test/value_sets_bytes_parser_test.rb +2 -0
- data/test/value_sets_records_parser_test.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b9c717d31cf5a4012568c9d8497947466408be7fef5610fba9143f7a911ed7c
|
|
4
|
+
data.tar.gz: 925bc5f645152eeb09f9583e9d50b9be67c4bfa8049c303571f82649262e4d5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 409d66e4d4e6e9ac31940cea097837d76c93cbeb4b95461323afc6a5f2ace736f945705e5ef33f2a851bb92c13c27e19ffbc14c7e776a0366f1d76091cafd51f
|
|
7
|
+
data.tar.gz: 6a0eaa48b85f7b1863dfb2b04c3c193a5e7e1108084556ba1b25fa303bccb40f62dd706ec8d4b5c3394239f167eb1807dfff4fe292edc1e4ad550719a9a63446
|
data/.github/workflows/test.yaml
CHANGED
|
@@ -20,12 +20,28 @@ jobs:
|
|
|
20
20
|
fail-fast: false
|
|
21
21
|
matrix:
|
|
22
22
|
ruby:
|
|
23
|
-
-
|
|
23
|
+
- 3.1
|
|
24
24
|
env:
|
|
25
|
-
- AR_VERSION: 7.0
|
|
25
|
+
- AR_VERSION: '7.0'
|
|
26
|
+
RUBYOPT: --enable-frozen-string-literal
|
|
26
27
|
- AR_VERSION: 6.1
|
|
27
|
-
|
|
28
|
+
RUBYOPT: --enable-frozen-string-literal
|
|
28
29
|
include:
|
|
30
|
+
- ruby: '3.0'
|
|
31
|
+
env:
|
|
32
|
+
AR_VERSION: '7.0'
|
|
33
|
+
- ruby: '3.0'
|
|
34
|
+
env:
|
|
35
|
+
AR_VERSION: 6.1
|
|
36
|
+
- ruby: 2.7
|
|
37
|
+
env:
|
|
38
|
+
AR_VERSION: '7.0'
|
|
39
|
+
- ruby: 2.7
|
|
40
|
+
env:
|
|
41
|
+
AR_VERSION: 6.1
|
|
42
|
+
- ruby: 2.7
|
|
43
|
+
env:
|
|
44
|
+
AR_VERSION: '6.0'
|
|
29
45
|
- ruby: 2.6
|
|
30
46
|
env:
|
|
31
47
|
AR_VERSION: 5.2
|
|
@@ -34,7 +50,7 @@ jobs:
|
|
|
34
50
|
AR_VERSION: 5.1
|
|
35
51
|
- ruby: 2.4
|
|
36
52
|
env:
|
|
37
|
-
AR_VERSION: 5.0
|
|
53
|
+
AR_VERSION: '5.0'
|
|
38
54
|
- ruby: 2.4
|
|
39
55
|
env:
|
|
40
56
|
AR_VERSION: 4.2
|
|
@@ -47,9 +63,7 @@ jobs:
|
|
|
47
63
|
- uses: ruby/setup-ruby@v1
|
|
48
64
|
with:
|
|
49
65
|
ruby-version: ${{ matrix.ruby }}
|
|
50
|
-
|
|
51
|
-
if: ${{ matrix.ruby == '2.3' }}
|
|
52
|
-
run: echo "BUNDLER_VERSION=1.17.3" >> $GITHUB_ENV
|
|
66
|
+
bundler-cache: true
|
|
53
67
|
- name: Set up databases
|
|
54
68
|
run: |
|
|
55
69
|
sudo /etc/init.d/mysql start
|
|
@@ -61,18 +75,33 @@ jobs:
|
|
|
61
75
|
cp test/github/database.yml test/database.yml
|
|
62
76
|
env:
|
|
63
77
|
PGPASSWORD: postgres
|
|
64
|
-
- name:
|
|
65
|
-
run : AR_VERSION=${{ env.AR_VERSION }} bundle install
|
|
66
|
-
- name: Run tests
|
|
78
|
+
- name: Run tests with mysql2
|
|
67
79
|
run: |
|
|
68
80
|
bundle exec rake test:mysql2
|
|
69
81
|
bundle exec rake test:mysql2_makara
|
|
70
82
|
bundle exec rake test:mysql2spatial
|
|
83
|
+
- name: Run tests with postgresql
|
|
84
|
+
run: |
|
|
71
85
|
bundle exec rake test:postgis
|
|
72
86
|
bundle exec rake test:postgresql
|
|
73
87
|
bundle exec rake test:postgresql_makara
|
|
88
|
+
- name: Run tests with seamless_database_pool
|
|
89
|
+
run: |
|
|
74
90
|
bundle exec rake test:seamless_database_pool
|
|
91
|
+
if: ${{ matrix.ruby < '3.0' }}
|
|
92
|
+
- name: Run tests with sqlite
|
|
93
|
+
run: |
|
|
75
94
|
bundle exec rake test:spatialite
|
|
76
95
|
bundle exec rake test:sqlite3
|
|
96
|
+
lint:
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
env:
|
|
99
|
+
AR_VERSION: '7.0'
|
|
100
|
+
steps:
|
|
101
|
+
- uses: actions/checkout@v2
|
|
102
|
+
- uses: ruby/setup-ruby@v1
|
|
103
|
+
with:
|
|
104
|
+
ruby-version: 2.7
|
|
105
|
+
bundler-cache: true
|
|
77
106
|
- name: Run Rubocop
|
|
78
107
|
run: bundle exec rubocop
|
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
|
3
|
-
Lint/EndAlignment:
|
|
4
|
-
AlignWith: variable
|
|
5
|
-
|
|
6
3
|
Metrics/AbcSize:
|
|
7
4
|
Enabled: false
|
|
8
5
|
|
|
6
|
+
Metrics/BlockLength:
|
|
7
|
+
Enabled: false
|
|
8
|
+
|
|
9
9
|
Metrics/ClassLength:
|
|
10
10
|
Enabled: false
|
|
11
11
|
|
|
@@ -24,8 +24,8 @@ Metrics/ModuleLength:
|
|
|
24
24
|
Metrics/PerceivedComplexity:
|
|
25
25
|
Enabled: false
|
|
26
26
|
|
|
27
|
-
Style/
|
|
28
|
-
|
|
27
|
+
Style/CommentedKeyword:
|
|
28
|
+
Enabled: false
|
|
29
29
|
|
|
30
30
|
Style/ClassAndModuleChildren:
|
|
31
31
|
Enabled: false
|
|
@@ -33,10 +33,25 @@ Style/ClassAndModuleChildren:
|
|
|
33
33
|
Style/Documentation:
|
|
34
34
|
Enabled: false
|
|
35
35
|
|
|
36
|
-
Style/
|
|
36
|
+
Style/EvalWithLocation:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
Style/ExpandPathArguments:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
Style/GuardClause:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Style/IfUnlessModifier:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/NumericPredicate:
|
|
49
|
+
Enabled: false
|
|
50
|
+
|
|
51
|
+
Style/PercentLiteralDelimiters:
|
|
37
52
|
Enabled: false
|
|
38
53
|
|
|
39
|
-
Style/
|
|
54
|
+
Style/RedundantBegin:
|
|
40
55
|
Enabled: false
|
|
41
56
|
|
|
42
57
|
Style/SpecialGlobalVars:
|
|
@@ -45,5 +60,56 @@ Style/SpecialGlobalVars:
|
|
|
45
60
|
Style/StringLiterals:
|
|
46
61
|
Enabled: false
|
|
47
62
|
|
|
48
|
-
Style/
|
|
63
|
+
Style/SymbolArray:
|
|
64
|
+
Enabled: false
|
|
65
|
+
|
|
66
|
+
Style/TrailingCommaInArrayLiteral:
|
|
67
|
+
Enabled: false
|
|
68
|
+
|
|
69
|
+
Layout/AlignArguments:
|
|
70
|
+
Enabled: false
|
|
71
|
+
|
|
72
|
+
Layout/AlignParameters:
|
|
73
|
+
EnforcedStyle: with_fixed_indentation
|
|
74
|
+
|
|
75
|
+
Layout/EndAlignment:
|
|
76
|
+
EnforcedStyleAlignWith: variable
|
|
77
|
+
|
|
78
|
+
Layout/ElseAlignment:
|
|
79
|
+
Enabled: false
|
|
80
|
+
|
|
81
|
+
Layout/EmptyLineAfterGuardClause:
|
|
82
|
+
Enabled: false
|
|
83
|
+
|
|
84
|
+
Layout/IndentHeredoc:
|
|
85
|
+
Enabled: false
|
|
86
|
+
|
|
87
|
+
Layout/SpaceInsideParens:
|
|
88
|
+
Enabled: false
|
|
89
|
+
|
|
90
|
+
Layout/SpaceInsidePercentLiteralDelimiters:
|
|
91
|
+
Enabled: false
|
|
92
|
+
|
|
93
|
+
Lint/ErbNewArguments:
|
|
94
|
+
Enabled: false
|
|
95
|
+
|
|
96
|
+
Lint/MissingCopEnableDirective:
|
|
97
|
+
Enabled: false
|
|
98
|
+
|
|
99
|
+
Lint/PercentStringArray:
|
|
100
|
+
Enabled: false
|
|
101
|
+
|
|
102
|
+
Naming/HeredocDelimiterNaming:
|
|
103
|
+
Enabled: false
|
|
104
|
+
|
|
105
|
+
Naming/UncommunicativeMethodParamName:
|
|
106
|
+
Enabled: false
|
|
107
|
+
|
|
108
|
+
Security/YAMLLoad:
|
|
109
|
+
Enabled: false
|
|
110
|
+
|
|
111
|
+
Gemspec/RequiredRubyVersion:
|
|
112
|
+
Enabled: false
|
|
113
|
+
|
|
114
|
+
Bundler/OrderedGems:
|
|
49
115
|
Enabled: false
|
data/Brewfile
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## Changes in 1.4.1
|
|
2
|
+
|
|
3
|
+
### Fixes
|
|
4
|
+
|
|
5
|
+
* Fix importing models that have required belongs_to associations and use composite primary keys. Thanks to @thoughtbot-summer vi \##783.
|
|
6
|
+
|
|
7
|
+
## Changes in 1.4.0
|
|
8
|
+
|
|
9
|
+
### New Features
|
|
10
|
+
|
|
11
|
+
* Enable compatibility with frozen string literals. Thanks to @desheikh via \##760.
|
|
12
|
+
|
|
1
13
|
## Changes in 1.3.0
|
|
2
14
|
|
|
3
15
|
### Fixes
|
data/Gemfile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
gemspec
|
|
@@ -13,7 +15,7 @@ pg_version = '0.9'
|
|
|
13
15
|
pg_version = '1.1' if version >= 6.1
|
|
14
16
|
|
|
15
17
|
group :development, :test do
|
|
16
|
-
gem 'rubocop', '~> 0.
|
|
18
|
+
gem 'rubocop', '~> 0.71.0'
|
|
17
19
|
gem 'rake'
|
|
18
20
|
end
|
|
19
21
|
|
|
@@ -22,7 +24,8 @@ platforms :ruby do
|
|
|
22
24
|
gem "mysql2", "~> #{mysql2_version}"
|
|
23
25
|
gem "pg", "~> #{pg_version}"
|
|
24
26
|
gem "sqlite3", "~> #{sqlite3_version}"
|
|
25
|
-
|
|
27
|
+
# seamless_database_pool requires Ruby ~> 2.0
|
|
28
|
+
gem "seamless_database_pool", "~> 1.0.20" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
platforms :jruby do
|
|
@@ -44,14 +47,9 @@ platforms :jruby do
|
|
|
44
47
|
gem "ruby-debug", "= 0.10.4"
|
|
45
48
|
end
|
|
46
49
|
|
|
47
|
-
platforms :mri_19 do
|
|
48
|
-
gem "debugger"
|
|
49
|
-
end
|
|
50
|
-
|
|
51
50
|
platforms :ruby do
|
|
52
51
|
gem "pry-byebug"
|
|
53
52
|
gem "pry", "~> 0.12.0"
|
|
54
|
-
gem "rb-readline"
|
|
55
53
|
end
|
|
56
54
|
|
|
57
55
|
if version >= 4.0
|
data/README.markdown
CHANGED
|
@@ -268,9 +268,9 @@ Key | Options | Default | Descrip
|
|
|
268
268
|
:validate_uniqueness | `true`/`false` | `false` | Whether or not to run uniqueness validations, has potential pitfalls, use with caution (requires `>= v0.27.0`).
|
|
269
269
|
:validate_with_context | `Symbol` |`:create`/`:update` | Allows passing an ActiveModel validation context for each model. Default is `:create` for new records and `:update` for existing ones.
|
|
270
270
|
:track_validation_failures| `true`/`false` | `false` | When this is set to true, `failed_instances` will be an array of arrays, with each inner array having the form `[:index_in_dataset, :object_with_errors]`
|
|
271
|
-
:on_duplicate_key_ignore | `true`/`false` | `false` | Allows skipping records with duplicate keys. See [here](
|
|
271
|
+
:on_duplicate_key_ignore | `true`/`false` | `false` | Allows skipping records with duplicate keys. See [here](#duplicate-key-ignore) for more details.
|
|
272
272
|
:ignore | `true`/`false` | `false` | Alias for :on_duplicate_key_ignore.
|
|
273
|
-
:on_duplicate_key_update | :all, `Array`, `Hash` | N/A | Allows upsert logic to be used. See [here](
|
|
273
|
+
:on_duplicate_key_update | :all, `Array`, `Hash` | N/A | Allows upsert logic to be used. See [here](#duplicate-key-update) for more details.
|
|
274
274
|
:synchronize | `Array` | N/A | An array of ActiveRecord instances. This synchronizes existing instances in memory with updates from the import.
|
|
275
275
|
:timestamps | `true`/`false` | `true` | Enables/disables timestamps on imported records.
|
|
276
276
|
:recursive | `true`/`false` | `false` | Imports has_many/has_one associations (PostgreSQL only).
|
|
@@ -433,7 +433,8 @@ Should you wish to specify those columns, you may use the option `timestamps: fa
|
|
|
433
433
|
|
|
434
434
|
However, it is also possible to set just `:created_at` in specific records. In this case despite using `timestamps: true`, `:created_at` will be updated only in records where that field is `nil`. Same rule applies for record associations when enabling the option `recursive: true`.
|
|
435
435
|
|
|
436
|
-
If you are using custom time zones, these will be respected when performing imports as well as long as `ActiveRecord::Base.default_timezone` is set, which for practically all Rails apps it is
|
|
436
|
+
If you are using custom time zones, these will be respected when performing imports as well as long as `ActiveRecord::Base.default_timezone` is set, which for practically all Rails apps it is.
|
|
437
|
+
NOTE: If you are using ActiveRecord 7.0 or later, please use `ActiveRecord.default_timezone` instead.
|
|
437
438
|
|
|
438
439
|
### Callbacks
|
|
439
440
|
|
|
@@ -572,7 +573,7 @@ When rubygems pushes the `lib` folder onto the load path a `require` will now fi
|
|
|
572
573
|
|
|
573
574
|
Activerecord-Import adds the `.import` method onto `ActiveRecord::Base`. There are other gems, such as `elasticsearch-rails`, that do the same thing. In conflicts such as this, there is an aliased method named `.bulk_import` that can be used interchangeably.
|
|
574
575
|
|
|
575
|
-
If you are using the `apartment` gem, there is a weird triple interaction between that gem, `activerecord-import`, and `activerecord` involving caching of the `sequence_name` of a model. This can be worked around by
|
|
576
|
+
If you are using the `apartment` gem, there is a weird triple interaction between that gem, `activerecord-import`, and `activerecord` involving caching of the `sequence_name` of a model. This can be worked around by explicitly setting this value within the model. For example:
|
|
576
577
|
|
|
577
578
|
```ruby
|
|
578
579
|
class Post < ActiveRecord::Base
|
|
@@ -615,13 +616,13 @@ After that, you can run the tests. They run against multiple tests and ActiveRec
|
|
|
615
616
|
|
|
616
617
|
This is one example of how to run the tests:
|
|
617
618
|
|
|
618
|
-
```
|
|
619
|
+
```bash
|
|
619
620
|
rm Gemfile.lock
|
|
620
|
-
AR_VERSION=
|
|
621
|
-
AR_VERSION=
|
|
621
|
+
AR_VERSION=7.0 bundle install
|
|
622
|
+
AR_VERSION=7.0 bundle exec rake test:postgresql test:sqlite3 test:mysql2
|
|
622
623
|
```
|
|
623
624
|
|
|
624
|
-
Once you have pushed up your changes, you can find your CI results [here](https://
|
|
625
|
+
Once you have pushed up your changes, you can find your CI results [here](https://github.com/zdennis/activerecord-import/actions).
|
|
625
626
|
|
|
626
627
|
## Issue Triage [](https://www.codetriage.com/zdennis/activerecord-import)
|
|
627
628
|
|
data/Rakefile
CHANGED
data/activerecord-import.gemspec
CHANGED
data/benchmarks/benchmark.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pathname'
|
|
2
4
|
require "fileutils"
|
|
3
5
|
require "active_record"
|
|
@@ -20,7 +22,11 @@ FileUtils.mkdir_p 'log'
|
|
|
20
22
|
ActiveRecord::Base.configurations["test"] = YAML.load_file(File.join(benchmark_dir, "../test/database.yml"))[options.adapter]
|
|
21
23
|
ActiveRecord::Base.logger = Logger.new("log/test.log")
|
|
22
24
|
ActiveRecord::Base.logger.level = Logger::DEBUG
|
|
23
|
-
ActiveRecord
|
|
25
|
+
if ActiveRecord.respond_to?(:default_timezone)
|
|
26
|
+
ActiveRecord.default_timezone = :utc
|
|
27
|
+
else
|
|
28
|
+
ActiveRecord::Base.default_timezone = :utc
|
|
29
|
+
end
|
|
24
30
|
|
|
25
31
|
require "activerecord-import"
|
|
26
32
|
ActiveRecord::Base.establish_connection(:test)
|
data/benchmarks/lib/base.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'optparse'
|
|
2
4
|
require 'ostruct'
|
|
3
5
|
|
|
@@ -8,7 +10,7 @@ require 'ostruct'
|
|
|
8
10
|
# * t - the table types to test. ie: myisam, innodb, memory, temporary, etc.
|
|
9
11
|
#
|
|
10
12
|
module BenchmarkOptionParser
|
|
11
|
-
BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options."
|
|
13
|
+
BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options."
|
|
12
14
|
|
|
13
15
|
def self.print_banner
|
|
14
16
|
puts BANNER
|
data/benchmarks/lib/float.rb
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'erb'
|
|
2
4
|
|
|
3
5
|
module OutputToHTML
|
|
4
|
-
TEMPLATE_HEADER = <<"EOT"
|
|
6
|
+
TEMPLATE_HEADER = <<"EOT"
|
|
5
7
|
<div>
|
|
6
8
|
All times are rounded to the nearest thousandth for display purposes. Speedups next to each time are computed
|
|
7
9
|
before any rounding occurs. Also, all speedup calculations are computed by comparing a given time against
|
|
@@ -9,7 +11,7 @@ module OutputToHTML
|
|
|
9
11
|
</div>
|
|
10
12
|
EOT
|
|
11
13
|
|
|
12
|
-
TEMPLATE = <<"EOT"
|
|
14
|
+
TEMPLATE = <<"EOT"
|
|
13
15
|
<style>
|
|
14
16
|
td#benchmarkTitle {
|
|
15
17
|
border: 1px solid black;
|
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.1.gemfile
CHANGED
data/gemfiles/5.2.gemfile
CHANGED
data/gemfiles/6.0.gemfile
CHANGED
data/gemfiles/6.1.gemfile
CHANGED
data/gemfiles/7.0.gemfile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveRecord::Import::MysqlAdapter
|
|
2
4
|
include ActiveRecord::Import::ImportSupport
|
|
3
5
|
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
|
|
@@ -82,7 +84,7 @@ module ActiveRecord::Import::MysqlAdapter
|
|
|
82
84
|
# Returns a generated ON DUPLICATE KEY UPDATE statement given the passed
|
|
83
85
|
# in +args+.
|
|
84
86
|
def sql_for_on_duplicate_key_update( table_name, *args ) # :nodoc:
|
|
85
|
-
sql = ' ON DUPLICATE KEY UPDATE '
|
|
87
|
+
sql = ' ON DUPLICATE KEY UPDATE '.dup
|
|
86
88
|
arg = args.first
|
|
87
89
|
locking_column = args.last
|
|
88
90
|
if arg.is_a?( Array )
|