activerecord-import 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +7 -1
- data/.rubocop.yml +74 -8
- data/.rubocop_todo.yml +6 -16
- data/Brewfile +3 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile +5 -3
- data/README.markdown +8 -6
- data/Rakefile +2 -0
- data/activerecord-import.gemspec +2 -1
- data/benchmarks/benchmark.rb +5 -3
- data/benchmarks/lib/base.rb +4 -2
- data/benchmarks/lib/cli_parser.rb +4 -2
- 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 +3 -0
- 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 +8 -5
- 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 +26 -18
- data/lib/activerecord-import/adapters/postgresql_adapter.rb +63 -42
- data/lib/activerecord-import/adapters/sqlite3_adapter.rb +33 -25
- data/lib/activerecord-import/base.rb +3 -1
- data/lib/activerecord-import/import.rb +60 -32
- 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 +3 -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 +21 -0
- data/test/jdbcmysql/import_test.rb +5 -3
- data/test/jdbcpostgresql/import_test.rb +4 -2
- data/test/jdbcsqlite3/import_test.rb +4 -2
- data/test/makara_postgis/import_test.rb +4 -2
- 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 +3 -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 +7 -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 +5 -3
- data/test/mysql2_makara/import_test.rb +5 -3
- data/test/mysqlspatial2/import_test.rb +5 -3
- data/test/postgis/import_test.rb +4 -2
- data/test/postgresql/import_test.rb +4 -2
- data/test/schema/generic_schema.rb +9 -0
- data/test/schema/jdbcpostgresql_schema.rb +3 -1
- data/test/schema/mysql2_schema.rb +2 -0
- data/test/schema/postgis_schema.rb +3 -1
- 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 +4 -2
- 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 +40 -1
- data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
- data/test/support/shared_examples/on_duplicate_key_update.rb +41 -10
- 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 +11 -3
- data/test/value_sets_bytes_parser_test.rb +3 -1
- data/test/value_sets_records_parser_test.rb +3 -1
- 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: 866dd09466fbda981329e13916e89986cb47d65259f0889b8a3b53aeca1aee32
|
4
|
+
data.tar.gz: 258a0d2fc34bbb928500e2f8a83df4f5bdc8901c25e2e123a569c56d587d3f53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 989562e1fb64d669a96211c6b80df5b89d8a43aa38575ec6706d0633b405983a63849bd5fb78d4031ed7e4b2c239192f62d4b3d9e720f4c474cd3801600d11ef
|
7
|
+
data.tar.gz: 22e6ccbb750bb7851930d98c2b90f496c759d35503c8c1e58b841f4a928a283c486caec3f22cb57e6948b6960e6fff2a598499f0670f59b281e321dded20c183
|
data/.github/workflows/test.yaml
CHANGED
@@ -20,13 +20,19 @@ jobs:
|
|
20
20
|
fail-fast: false
|
21
21
|
matrix:
|
22
22
|
ruby:
|
23
|
-
- 3.
|
23
|
+
- 3.2
|
24
24
|
env:
|
25
25
|
- AR_VERSION: '7.0'
|
26
26
|
RUBYOPT: --enable-frozen-string-literal
|
27
27
|
- AR_VERSION: 6.1
|
28
28
|
RUBYOPT: --enable-frozen-string-literal
|
29
29
|
include:
|
30
|
+
- ruby: 3.1
|
31
|
+
env:
|
32
|
+
AR_VERSION: '7.0'
|
33
|
+
- ruby: 3.1
|
34
|
+
env:
|
35
|
+
AR_VERSION: 6.1
|
30
36
|
- ruby: '3.0'
|
31
37
|
env:
|
32
38
|
AR_VERSION: '7.0'
|
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/ArgumentAlignment:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Layout/ParameterAlignment:
|
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/HeredocIndentation:
|
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/MethodParameterName:
|
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/.rubocop_todo.yml
CHANGED
@@ -1,36 +1,26 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-02-15 00:58:14 UTC using RuboCop version 1.45.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 2
|
10
|
-
Lint/HandleExceptions:
|
11
|
-
Exclude:
|
12
|
-
- 'lib/activerecord-import/base.rb'
|
13
|
-
- 'test/import_test.rb'
|
14
|
-
|
15
9
|
# Offense count: 2
|
16
10
|
Lint/RescueException:
|
17
11
|
Exclude:
|
18
12
|
- 'benchmarks/lib/cli_parser.rb'
|
19
13
|
- 'test/import_test.rb'
|
20
14
|
|
21
|
-
# Offense count:
|
22
|
-
#
|
23
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
15
|
+
# Offense count: 3
|
16
|
+
# This cop supports safe autocorrection (--autocorrect).
|
17
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
24
18
|
Lint/UnusedMethodArgument:
|
25
19
|
Exclude:
|
26
20
|
- 'lib/activerecord-import/adapters/postgresql_adapter.rb'
|
27
21
|
- 'lib/activerecord-import/import.rb'
|
28
22
|
|
29
23
|
# Offense count: 2
|
30
|
-
|
31
|
-
# Configuration parameters: Keywords.
|
32
|
-
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW
|
33
|
-
Style/CommentAnnotation:
|
24
|
+
Style/CombinableLoops:
|
34
25
|
Exclude:
|
35
|
-
- '
|
36
|
-
- 'lib/activerecord-import/import.rb'
|
26
|
+
- 'test/support/shared_examples/recursive_import.rb'
|
data/Brewfile
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## Changes in 1.5.0
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* Add Rails 7.1 support. Thanks to @gucki via \##807.
|
6
|
+
* Add support for alias attributes. Thanks to @leonidkroka via \##799.
|
7
|
+
|
8
|
+
### Fixes
|
9
|
+
|
10
|
+
* Support for multi-byte column names when splitting queries. Thanks to @TakuyaKurimoto via \##801.
|
11
|
+
* Fix issue with track_validation_failures when import models. Thanks to @OtaYohihiro via \##798.
|
12
|
+
|
13
|
+
## Changes in 1.4.1
|
14
|
+
|
15
|
+
### Fixes
|
16
|
+
|
17
|
+
* Fix importing models that have required belongs_to associations and use composite primary keys. Thanks to @thoughtbot-summer via \##783.
|
18
|
+
|
1
19
|
## Changes in 1.4.0
|
2
20
|
|
3
21
|
### New Features
|
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'
|
18
|
+
gem 'rubocop'
|
17
19
|
gem 'rake'
|
18
20
|
end
|
19
21
|
|
@@ -38,7 +40,7 @@ end
|
|
38
40
|
gem "factory_bot"
|
39
41
|
gem "timecop"
|
40
42
|
gem "chronic"
|
41
|
-
gem "mocha", "~> 1.
|
43
|
+
gem "mocha", "~> 2.1.0"
|
42
44
|
|
43
45
|
# Debugging
|
44
46
|
platforms :jruby do
|
@@ -47,7 +49,7 @@ end
|
|
47
49
|
|
48
50
|
platforms :ruby do
|
49
51
|
gem "pry-byebug"
|
50
|
-
gem "pry", "~> 0.
|
52
|
+
gem "pry", "~> 0.14.0"
|
51
53
|
end
|
52
54
|
|
53
55
|
if version >= 4.0
|
data/README.markdown
CHANGED
@@ -245,8 +245,8 @@ Book.import columns, books, batch_size: 2, batch_progress: my_proc
|
|
245
245
|
|
246
246
|
#### Recursive
|
247
247
|
|
248
|
-
|
249
|
-
hashes or arrays as recursive inputs.
|
248
|
+
> **Note**
|
249
|
+
> This only works with PostgreSQL and ActiveRecord objects. This won't work with hashes or arrays as recursive inputs.
|
250
250
|
|
251
251
|
Assume that Books <code>has_many</code> Reviews.
|
252
252
|
|
@@ -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).
|
@@ -434,7 +434,8 @@ Should you wish to specify those columns, you may use the option `timestamps: fa
|
|
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
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
|
-
|
437
|
+
> **Note**
|
438
|
+
> If you are using ActiveRecord 7.0 or later, please use `ActiveRecord.default_timezone` instead.
|
438
439
|
|
439
440
|
### Callbacks
|
440
441
|
|
@@ -506,7 +507,8 @@ This allows an external gem to dynamically add an adapter without the need to ad
|
|
506
507
|
|
507
508
|
### Requiring
|
508
509
|
|
509
|
-
Note
|
510
|
+
> **Note**
|
511
|
+
> These instructions will only work if you are using version 0.2.0 or higher.
|
510
512
|
|
511
513
|
#### Autoloading via Bundler
|
512
514
|
|
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"
|
@@ -39,7 +41,7 @@ require File.join(benchmark_dir, "../test/schema/generic_schema")
|
|
39
41
|
adapter_schema = File.join(benchmark_dir, "schema/#{options.adapter}_schema.rb")
|
40
42
|
require adapter_schema if File.exist?(adapter_schema)
|
41
43
|
|
42
|
-
Dir[File.dirname(__FILE__)
|
44
|
+
Dir["#{File.dirname(__FILE__)}/models/*.rb"].sort.each { |file| require file }
|
43
45
|
|
44
46
|
require File.join( benchmark_dir, 'lib', "#{options.adapter}_benchmark" )
|
45
47
|
|
@@ -51,8 +53,8 @@ else
|
|
51
53
|
end
|
52
54
|
|
53
55
|
letter = options.adapter[0].chr
|
54
|
-
clazz_str = letter.upcase + options.adapter[1
|
55
|
-
clazz = Object.const_get( clazz_str
|
56
|
+
clazz_str = letter.upcase + options.adapter[1..].downcase
|
57
|
+
clazz = Object.const_get( "#{clazz_str}Benchmark" )
|
56
58
|
|
57
59
|
benchmarks = []
|
58
60
|
options.number_of_objects.each do |num|
|
data/benchmarks/lib/base.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class BenchmarkBase
|
2
4
|
attr_reader :results
|
3
5
|
|
@@ -25,11 +27,11 @@ class BenchmarkBase
|
|
25
27
|
# An OpenStruct object with the following attributes:
|
26
28
|
# * description - the description of the benchmark ran
|
27
29
|
# * tms - a Benchmark::Tms containing the results of the benchmark
|
28
|
-
def bm( description )
|
30
|
+
def bm( description, &block )
|
29
31
|
tms = nil
|
30
32
|
puts "Benchmarking #{description}"
|
31
33
|
|
32
|
-
Benchmark.bm { |x| tms = x.report
|
34
|
+
Benchmark.bm { |x| tms = x.report(&block) }
|
33
35
|
delete_all
|
34
36
|
failed = false
|
35
37
|
|
@@ -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
|
@@ -27,7 +29,7 @@ module BenchmarkOptionParser
|
|
27
29
|
print_valid_table_types( options, prefix: " " )
|
28
30
|
end
|
29
31
|
|
30
|
-
# TODO IMPLEMENT THIS
|
32
|
+
# TODO: IMPLEMENT THIS
|
31
33
|
def self.print_valid_table_types( options, hsh = { prefix: '' } )
|
32
34
|
if !options.table_types.keys.empty?
|
33
35
|
options.table_types.keys.sort.each { |type| puts hsh[:prefix].to_s + type.to_s }
|
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::AbstractAdapter
|
2
4
|
module InstanceMethods
|
3
5
|
def next_value_for_sequence(sequence_name)
|
@@ -7,10 +9,11 @@ module ActiveRecord::Import::AbstractAdapter
|
|
7
9
|
def insert_many( sql, values, _options = {}, *args ) # :nodoc:
|
8
10
|
number_of_inserts = 1
|
9
11
|
|
10
|
-
base_sql, post_sql =
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
base_sql, post_sql = case sql
|
13
|
+
when String
|
14
|
+
[sql, '']
|
15
|
+
when Array
|
16
|
+
[sql.shift, sql.join( ' ' )]
|
14
17
|
end
|
15
18
|
|
16
19
|
sql2insert = base_sql + values.join( ',' ) + post_sql
|
@@ -45,7 +48,7 @@ module ActiveRecord::Import::AbstractAdapter
|
|
45
48
|
post_sql_statements = []
|
46
49
|
|
47
50
|
if supports_on_duplicate_key_update? && options[:on_duplicate_key_update]
|
48
|
-
post_sql_statements << sql_for_on_duplicate_key_update( table_name, options[:on_duplicate_key_update], options[:primary_key], options[:locking_column] )
|
51
|
+
post_sql_statements << sql_for_on_duplicate_key_update( table_name, options[:on_duplicate_key_update], options[:model], options[:primary_key], options[:locking_column] )
|
49
52
|
elsif logger && options[:on_duplicate_key_update]
|
50
53
|
logger.warn "Ignoring on_duplicate_key_update because it is not supported by the database."
|
51
54
|
end
|