activerecord-import 0.22.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.
Files changed (130) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yaml +107 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +74 -8
  5. data/Brewfile +3 -1
  6. data/CHANGELOG.md +235 -3
  7. data/Gemfile +22 -15
  8. data/LICENSE +21 -56
  9. data/README.markdown +574 -22
  10. data/Rakefile +4 -1
  11. data/activerecord-import.gemspec +6 -5
  12. data/benchmarks/benchmark.rb +7 -1
  13. data/benchmarks/lib/base.rb +2 -0
  14. data/benchmarks/lib/cli_parser.rb +3 -1
  15. data/benchmarks/lib/float.rb +2 -0
  16. data/benchmarks/lib/mysql2_benchmark.rb +2 -0
  17. data/benchmarks/lib/output_to_csv.rb +2 -0
  18. data/benchmarks/lib/output_to_html.rb +4 -2
  19. data/benchmarks/models/test_innodb.rb +2 -0
  20. data/benchmarks/models/test_memory.rb +2 -0
  21. data/benchmarks/models/test_myisam.rb +2 -0
  22. data/benchmarks/schema/{mysql_schema.rb → mysql2_schema.rb} +2 -0
  23. data/gemfiles/4.2.gemfile +2 -0
  24. data/gemfiles/5.0.gemfile +2 -0
  25. data/gemfiles/5.1.gemfile +2 -0
  26. data/gemfiles/5.2.gemfile +4 -0
  27. data/gemfiles/6.0.gemfile +4 -0
  28. data/gemfiles/6.1.gemfile +4 -0
  29. data/gemfiles/7.0.gemfile +4 -0
  30. data/lib/activerecord-import/active_record/adapters/abstract_adapter.rb +2 -0
  31. data/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb +6 -4
  32. data/lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb +2 -0
  33. data/lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb +2 -0
  34. data/lib/activerecord-import/active_record/adapters/mysql2_adapter.rb +2 -0
  35. data/lib/activerecord-import/active_record/adapters/postgresql_adapter.rb +2 -0
  36. data/lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb +2 -0
  37. data/lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb +2 -0
  38. data/lib/activerecord-import/adapters/abstract_adapter.rb +10 -2
  39. data/lib/activerecord-import/adapters/em_mysql2_adapter.rb +2 -0
  40. data/lib/activerecord-import/adapters/mysql2_adapter.rb +2 -0
  41. data/lib/activerecord-import/adapters/mysql_adapter.rb +19 -11
  42. data/lib/activerecord-import/adapters/postgresql_adapter.rb +56 -37
  43. data/lib/activerecord-import/adapters/sqlite3_adapter.rb +128 -9
  44. data/lib/activerecord-import/base.rb +12 -2
  45. data/lib/activerecord-import/import.rb +300 -136
  46. data/lib/activerecord-import/mysql2.rb +2 -0
  47. data/lib/activerecord-import/postgresql.rb +2 -0
  48. data/lib/activerecord-import/sqlite3.rb +2 -0
  49. data/lib/activerecord-import/synchronize.rb +4 -2
  50. data/lib/activerecord-import/value_sets_parser.rb +4 -0
  51. data/lib/activerecord-import/version.rb +3 -1
  52. data/lib/activerecord-import.rb +4 -1
  53. data/test/adapters/jdbcmysql.rb +2 -0
  54. data/test/adapters/jdbcpostgresql.rb +2 -0
  55. data/test/adapters/jdbcsqlite3.rb +2 -0
  56. data/test/adapters/makara_postgis.rb +3 -0
  57. data/test/adapters/mysql2.rb +2 -0
  58. data/test/adapters/mysql2_makara.rb +2 -0
  59. data/test/adapters/mysql2spatial.rb +2 -0
  60. data/test/adapters/postgis.rb +2 -0
  61. data/test/adapters/postgresql.rb +2 -0
  62. data/test/adapters/postgresql_makara.rb +2 -0
  63. data/test/adapters/seamless_database_pool.rb +2 -0
  64. data/test/adapters/spatialite.rb +2 -0
  65. data/test/adapters/sqlite3.rb +2 -0
  66. data/test/{travis → github}/database.yml +3 -1
  67. data/test/import_test.rb +159 -8
  68. data/test/jdbcmysql/import_test.rb +2 -0
  69. data/test/jdbcpostgresql/import_test.rb +2 -0
  70. data/test/jdbcsqlite3/import_test.rb +2 -0
  71. data/test/makara_postgis/import_test.rb +10 -0
  72. data/test/models/account.rb +5 -0
  73. data/test/models/alarm.rb +2 -0
  74. data/test/models/animal.rb +8 -0
  75. data/test/models/bike_maker.rb +9 -0
  76. data/test/models/book.rb +2 -0
  77. data/test/models/car.rb +2 -0
  78. data/test/models/card.rb +5 -0
  79. data/test/models/chapter.rb +2 -0
  80. data/test/models/customer.rb +8 -0
  81. data/test/models/deck.rb +8 -0
  82. data/test/models/dictionary.rb +2 -0
  83. data/test/models/discount.rb +2 -0
  84. data/test/models/end_note.rb +2 -0
  85. data/test/models/group.rb +2 -0
  86. data/test/models/order.rb +8 -0
  87. data/test/models/playing_card.rb +4 -0
  88. data/test/models/promotion.rb +2 -0
  89. data/test/models/question.rb +2 -0
  90. data/test/models/rule.rb +2 -0
  91. data/test/models/tag.rb +3 -0
  92. data/test/models/tag_alias.rb +5 -0
  93. data/test/models/topic.rb +2 -0
  94. data/test/models/user.rb +5 -0
  95. data/test/models/user_token.rb +6 -0
  96. data/test/models/vendor.rb +2 -0
  97. data/test/models/widget.rb +2 -0
  98. data/test/mysql2/import_test.rb +2 -0
  99. data/test/mysql2_makara/import_test.rb +2 -0
  100. data/test/mysqlspatial2/import_test.rb +2 -0
  101. data/test/postgis/import_test.rb +2 -0
  102. data/test/postgresql/import_test.rb +2 -0
  103. data/test/schema/generic_schema.rb +53 -0
  104. data/test/schema/jdbcpostgresql_schema.rb +2 -0
  105. data/test/schema/mysql2_schema.rb +21 -0
  106. data/test/schema/postgis_schema.rb +2 -0
  107. data/test/schema/postgresql_schema.rb +18 -0
  108. data/test/schema/sqlite3_schema.rb +15 -0
  109. data/test/schema/version.rb +2 -0
  110. data/test/sqlite3/import_test.rb +2 -0
  111. data/test/support/active_support/test_case_extensions.rb +2 -0
  112. data/test/support/assertions.rb +2 -0
  113. data/test/support/factories.rb +10 -8
  114. data/test/support/generate.rb +10 -8
  115. data/test/support/mysql/import_examples.rb +14 -1
  116. data/test/support/postgresql/import_examples.rb +140 -3
  117. data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
  118. data/test/support/shared_examples/on_duplicate_key_update.rb +263 -0
  119. data/test/support/shared_examples/recursive_import.rb +76 -4
  120. data/test/support/sqlite3/import_examples.rb +191 -26
  121. data/test/synchronize_test.rb +2 -0
  122. data/test/test_helper.rb +36 -3
  123. data/test/value_sets_bytes_parser_test.rb +2 -0
  124. data/test/value_sets_records_parser_test.rb +2 -0
  125. metadata +46 -18
  126. data/.travis.yml +0 -61
  127. data/gemfiles/3.2.gemfile +0 -2
  128. data/gemfiles/4.0.gemfile +0 -2
  129. data/gemfiles/4.1.gemfile +0 -2
  130. data/test/schema/mysql_schema.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 89358f97c9fd1550a1d32d572db5f126d41b6b9c
4
- data.tar.gz: e840ba026216f3e0bc60a91b52bb207a558324d0
2
+ SHA256:
3
+ metadata.gz: 1b9c717d31cf5a4012568c9d8497947466408be7fef5610fba9143f7a911ed7c
4
+ data.tar.gz: 925bc5f645152eeb09f9583e9d50b9be67c4bfa8049c303571f82649262e4d5b
5
5
  SHA512:
6
- metadata.gz: de20a46627950ac06773a6b8215b5dd134a3dc0f574407e9980c69dcc45a19b08db80aee089812b83be356913bf8f343737fec8166a0a77356e5fb546ec80e8b
7
- data.tar.gz: d1de87a630f697453cfbba9cb83e64b061c157a7d65affc271bfced0e4088afbc0870dcba0dfbc2c2ca1bc8854b137abcb0e8114de0471acb823ba9692df8f1c
6
+ metadata.gz: 409d66e4d4e6e9ac31940cea097837d76c93cbeb4b95461323afc6a5f2ace736f945705e5ef33f2a851bb92c13c27e19ffbc14c7e776a0366f1d76091cafd51f
7
+ data.tar.gz: 6a0eaa48b85f7b1863dfb2b04c3c193a5e7e1108084556ba1b25fa303bccb40f62dd706ec8d4b5c3394239f167eb1807dfff4fe292edc1e4ad550719a9a63446
@@ -0,0 +1,107 @@
1
+ name: Test
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ services:
6
+ postgres:
7
+ image: postgis/postgis:10-2.5
8
+ env:
9
+ POSTGRES_USER: postgres
10
+ POSTGRES_PASSWORD: postgres
11
+ ports:
12
+ - 5432:5432
13
+ # Set health checks to wait until postgres has started
14
+ options: >-
15
+ --health-cmd pg_isready
16
+ --health-interval 10s
17
+ --health-timeout 5s
18
+ --health-retries 5
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ ruby:
23
+ - 3.1
24
+ env:
25
+ - AR_VERSION: '7.0'
26
+ RUBYOPT: --enable-frozen-string-literal
27
+ - AR_VERSION: 6.1
28
+ RUBYOPT: --enable-frozen-string-literal
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'
45
+ - ruby: 2.6
46
+ env:
47
+ AR_VERSION: 5.2
48
+ - ruby: 2.6
49
+ env:
50
+ AR_VERSION: 5.1
51
+ - ruby: 2.4
52
+ env:
53
+ AR_VERSION: '5.0'
54
+ - ruby: 2.4
55
+ env:
56
+ AR_VERSION: 4.2
57
+ runs-on: ubuntu-latest
58
+ env:
59
+ AR_VERSION: ${{ matrix.env.AR_VERSION }}
60
+ DB_DATABASE: activerecord_import_test
61
+ steps:
62
+ - uses: actions/checkout@v2
63
+ - uses: ruby/setup-ruby@v1
64
+ with:
65
+ ruby-version: ${{ matrix.ruby }}
66
+ bundler-cache: true
67
+ - name: Set up databases
68
+ run: |
69
+ sudo /etc/init.d/mysql start
70
+ mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }} CHARACTER SET utf8 COLLATE utf8_general_ci;' -u root -proot
71
+ psql -h localhost -U postgres -c 'create database ${{ env.DB_DATABASE }};'
72
+ psql -h localhost -U postgres -d ${{ env.DB_DATABASE }} -c 'create extension if not exists hstore;'
73
+ psql -h localhost -U postgres -c 'create extension if not exists postgis;'
74
+ psql -h localhost -U postgres -c 'create extension if not exists "uuid-ossp";'
75
+ cp test/github/database.yml test/database.yml
76
+ env:
77
+ PGPASSWORD: postgres
78
+ - name: Run tests with mysql2
79
+ run: |
80
+ bundle exec rake test:mysql2
81
+ bundle exec rake test:mysql2_makara
82
+ bundle exec rake test:mysql2spatial
83
+ - name: Run tests with postgresql
84
+ run: |
85
+ bundle exec rake test:postgis
86
+ bundle exec rake test:postgresql
87
+ bundle exec rake test:postgresql_makara
88
+ - name: Run tests with seamless_database_pool
89
+ run: |
90
+ bundle exec rake test:seamless_database_pool
91
+ if: ${{ matrix.ruby < '3.0' }}
92
+ - name: Run tests with sqlite
93
+ run: |
94
+ bundle exec rake test:spatialite
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
106
+ - name: Run Rubocop
107
+ run: bundle exec rubocop
data/.gitignore CHANGED
@@ -24,6 +24,7 @@ pkg
24
24
  log/*.log
25
25
  test.db
26
26
  test/database.yml
27
+ benchmarks/log/
27
28
 
28
29
  .ruby-*
29
30
  .bundle/
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/AlignParameters:
28
- EnforcedStyle: with_fixed_indentation
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/ElseAlignment:
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/SpaceInsideParens:
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/TrailingCommaInLiteral:
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  brew "mysql"
2
4
  brew "postgresql"
3
- brew "sqlite"
5
+ brew "sqlite"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,233 @@
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
+
13
+ ## Changes in 1.3.0
14
+
15
+ ### Fixes
16
+
17
+ * Ensure correct timestamp values are returned for models after insert. Thanks to @kos1kov via \##756.
18
+ * Restore database_version method to public scope. Thanks to @beauraF via \##753.
19
+
20
+ ### New Features
21
+
22
+ * Add support for ActiveRecord 7.0. Thanks to @nickhammond, @ryanwood, @jkowens via \##749 and \##752.
23
+ * Add support for compound foreign keys. Thanks to @Uladzimiro via \##750.
24
+ * Add support for :recursive combined with on_duplicate_key_update: :all. Thanks to @deathwish via \##746.
25
+
26
+ ## Changes in 1.2.0
27
+
28
+ ### Fixes
29
+
30
+ * Update JDBC MySQL adapter to use mysql2 connection adapter. Thanks to @terencechow via \##744.
31
+ * Fix importing STI models with ActiveRecord 6. Thanks to @clemens1483 via \##743.
32
+ * Use polymorphic_name instead of base_class.name for imports. Thanks to @kmhajjar via \##741.
33
+ * Fix compatibility issue with composite primary keys. Thanks to @dlanileonardo via \##737.
34
+ * Prevent double validation of associations on recursive import.
35
+
36
+ ## Changes in 1.1.0
37
+
38
+ ### New Features
39
+
40
+ * Add batch progress reporting. Thanks to @gee-forr via \##729.
41
+
42
+ ## Changes in 1.0.8
43
+
44
+ ### Fixes
45
+
46
+ * Use correct method for clearing query cache. Thanks to @EtienneDepaulis via \##719.
47
+
48
+ ## Changes in 1.0.7
49
+
50
+ ### New Features
51
+
52
+ * Use @@max_allowed_packet session variable instead of querying SHOW VARIABLES. Thanks to @diclophis via \#706.
53
+ * Add option :track_validation_failures. 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]. Thanks to @rorymckinley via \#684.
54
+
55
+ ### Fixes
56
+
57
+ * Prevent mass-assignment errors in Rails strict mode. Thanks to @diclophis via \##709.
58
+
59
+ ## Changes in 1.0.6
60
+
61
+ ### Fixes
62
+
63
+ * Handle after_initialize callbacks. Thanks to @AhMohsen46 via \#691 and
64
+ \#692.
65
+ * Fix regression introduced in 1.0.4. Explicitly allow adapters to
66
+ support on duplicate key update. Thanks to @dsobiera, @jkowens via \#696.
67
+
68
+ ## Changes in 1.0.5
69
+
70
+ ### Fixes
71
+
72
+ * Allow serialized attributes to be returned from import. Thanks to @timanovsky, @jkowens via \#660.
73
+ * Return ActiveRecord::Connection from
74
+ ActiveRecord::Base#establish_connection. Thanks to @reverentF via
75
+ \#663.
76
+ * Support PostgreSQL array. Thanks to @ujihisa via \#669.
77
+ * Skip loading association ids when column changed. Thanks to @Aristat
78
+ via \#673.
79
+
80
+ ## Changes in 1.0.4
81
+
82
+ ### Fixes
83
+
84
+ * Use prepend pattern for ActiveRecord::Base#establish_connection patching. Thanks to @dombesz via \#648.
85
+ * Fix NoMethodError when using PostgreSQL ENUM types. Thanks to @sebcoetzee via \#651.
86
+ * Fix issue updating optimistic lock in Postgres. Thanks to @timanovsky
87
+ via \#656.
88
+
89
+ ## Changes in 1.0.3
90
+
91
+ ### New Features
92
+
93
+ * Add support for ActiveRecord 6.1.0.alpha. Thanks to @imtayadeway via
94
+ \#642.
95
+
96
+ ### Fixes
97
+
98
+ * Return an empty array for results instead of nil when importing empty
99
+ array. Thanks to @gyfis via \#636.
100
+
101
+ ## Changes in 1.0.2
102
+
103
+ ### New Features
104
+
105
+ * Add support for CockroachDB adapter. Thanks to @willie via \#605.
106
+ * Add support for ActiveRecord 6.0.0.rc1. Thanks to @madeindjs, @bill-filler,
107
+ @jkowens via \#619, \#623.
108
+
109
+ ### Fixes
110
+
111
+ * Fixes NoMethodError when attempting to use nil logger. Thanks to @MattMecel,
112
+ @khiav22357.
113
+ * Fix issue validating STI models. Thanks to @thejbsmith, @jkowens via
114
+ \#626.
115
+
116
+ ## Changes in 1.0.1
117
+
118
+ ### Fixes
119
+
120
+ * Raise an error with a helpful message if array of values exceeds the number of
121
+ columns for a table. Thanks to @golddranks via \#589.
122
+ * Properly check if model responds to import before creating alias.
123
+ Thanks to @jcw- via \#591.
124
+ * No longer pass :returning option to child associations on recursive
125
+ import. Thanks to @dmitriy-kiriyenko via \#595.
126
+ * Fix import issue for models with Postgresql json/jsonb fields. Thanks
127
+ to @stokarenko via \#594.
128
+ * Fix issue importing models with timestamps that contain timezone
129
+ information. Thanks to @dekaikiwi, @jkowens via \#598.
130
+ * Ignore :no_returning when using :recursive option. Thanks to @dgollahon, @jkowens
131
+ via \#599.
132
+
133
+ ## Changes in 1.0.0
134
+
135
+ ### New Features
136
+
137
+ * Move ActiveRecord::Dirty changes to previous_changes after import.
138
+ Thanks to @stokarenko via \#584.
139
+
140
+ ### Breaking Changes
141
+
142
+ * Previously :on_duplicate_key_update was enabled by default for MySQL.
143
+ The update timestamp columns (updated_at, updated_on) would be updated
144
+ on duplicate key. This was behavior is inconsistent with the other database
145
+ adapters and could also be considered surprising. Going forward it must
146
+ be explicitly enabled. See \#548.
147
+
148
+ ## Changes in 0.28.2
149
+
150
+ ### Fixes
151
+
152
+ * Fix issue where validations where not working in certain scenarios.
153
+ Thanks to @CASIXx1 via \#579.
154
+
155
+ ## Changes in 0.28.1
156
+
157
+ ### Fixes
158
+
159
+ * Fix issue where ActiveRecord presence validations were being mutated.
160
+ Limited custom presence validation to bulk imports.
161
+
162
+ ## Changes in 0.28.0
163
+
164
+ ### New Features
165
+
166
+ * Allow updated timestamps to be manually set.Thanks to @Rob117, @jkowens via \#570.
167
+
168
+ ### Fixes
169
+
170
+ * Fix validating presence of belongs_to associations. Existence
171
+ of the parent record is not validated, but the foreign key field
172
+ cannot be empty. Thanks to @Rob117, @jkowens via \#575.
173
+
174
+ ## Changes in 0.27.0
175
+
176
+ ### New Features
177
+
178
+ * Add "secret" option validate_uniqueness to enable uniqueness
179
+ validators when validating import. This is not a recommended
180
+ approach (See #228), but is being added back in for projects
181
+ that depended on this feature. Thanks to @jkowens via \#554.
182
+
183
+ ## Changes in 0.26.0
184
+
185
+ ### New Features
186
+
187
+ * Add on_duplicate_key_update for SQLite. Thanks to @jkowens via \#542.
188
+ * Add option to update all fields on_duplicate_key_update. Thanks to @aimerald, @jkowens via \#543.
189
+
190
+ ### Fixes
191
+
192
+ * Handle deeply frozen options hashes. Thanks to @jturkel via \#546.
193
+ * Switch from FactoryGirl to FactoryBot. Thanks to @koic via \#547.
194
+ * Allow import to work with ProxySQL. Thanks to @GregFarrell via \#550.
195
+
196
+ ## Changes in 0.25.0
197
+
198
+ ### New Features
199
+
200
+ * Add support for makara_postgis adapter. Thanks to @chadwilken via \#527.
201
+ * Skip validating presence of belongs_to associations. Thanks to @Sohair63, @naiyt, @jkowens via \#528.
202
+
203
+ ### Fixes
204
+
205
+ * Add missing require for ActiveSupport.on_load. Thanks to @onk via \#529.
206
+ * Support setting attribute values in before_validation callbacks.
207
+ Thanks to @SirRawlins, @jkowens via \#531.
208
+ * Ignore virtual columns. Thanks to @dbourguignon, @jkowens via \#530.
209
+
210
+ ## Changes in 0.24.0
211
+
212
+ ### Fixes
213
+
214
+ * Use the association primary key when importing. Thanks to @dpogue via \#512.
215
+ * Allow association ids to be updated. Thanks to @Aristat via \#515.
216
+
217
+ ## Changes in 0.23.0
218
+
219
+ ### New Features
220
+
221
+ * Rename `import` method to `bulk_import` and alias to `import`. Thanks
222
+ to @itay-grudev, @jkowens via \#498.
223
+ * Increment lock_version on duplicate key update. Thanks to @aimerald
224
+ via \#500.
225
+
226
+ ### Fixes
227
+
228
+ * Fix import_without_validations_or_callbacks exception if array is empty.
229
+ Thanks to @doloopwhile via \#508.
230
+
1
231
  ## Changes in 0.22.0
2
232
 
3
233
  ### New Features
@@ -7,7 +237,9 @@
7
237
 
8
238
  ### Fixes
9
239
 
10
- * Fix validation logic for recursive import. Thanks to @eric-simonton-sama, @jkowens via
240
+ * Fix validation logic for recursive import. For those on Rails 5.0 and 5.1,
241
+ this change requires models with polymorphic associations to specify the `inverse_of`
242
+ argument (See issue #495). Thanks to @eric-simonton-sama, @jkowens via
11
243
  \#489.
12
244
 
13
245
  ## Changes in 0.21.0
@@ -109,7 +341,7 @@
109
341
  Thanks to @jkowens via \#301.
110
342
  * Allow for custom timestamp columns. Thanks to @mojidabckuu, @jkowens
111
343
  via \#401.
112
-
344
+
113
345
  ### Fixes
114
346
 
115
347
  * Fix ActiveRecord 5 issue coercing boolean values when serializing
@@ -121,7 +353,7 @@
121
353
 
122
354
  * Fix issue where PostgreSQL cannot recognize columns if names
123
355
  include mixed case characters. Thanks to @hugobgranja via \#379.
124
- * Fix an issue for ActiveRecord 5 where serialized fields with
356
+ * Fix an issue for ActiveRecord 5 where serialized fields with
125
357
  default values were not being typecast. Thanks to @whistlerbrk,
126
358
  @jkowens via \#386.
127
359
  * Add option :force_single_insert for MySQL to make sure a single
data/Gemfile CHANGED
@@ -1,18 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
7
+ version = ENV['AR_VERSION'].to_f
8
+
9
+ mysql2_version = '0.3.0'
10
+ mysql2_version = '0.4.0' if version >= 4.2
11
+ mysql2_version = '0.5.0' if version >= 6.1
12
+ sqlite3_version = '1.3.0'
13
+ sqlite3_version = '1.4.0' if version >= 6.0
14
+ pg_version = '0.9'
15
+ pg_version = '1.1' if version >= 6.1
16
+
5
17
  group :development, :test do
6
- gem 'rubocop', '~> 0.40.0'
18
+ gem 'rubocop', '~> 0.71.0'
7
19
  gem 'rake'
8
20
  end
9
21
 
10
22
  # Database Adapters
11
23
  platforms :ruby do
12
- gem "mysql2", "~> 0.3.0"
13
- gem "pg", "~> 0.9"
14
- gem "sqlite3", "~> 1.3.10"
15
- gem "seamless_database_pool", "~> 1.0.20"
24
+ gem "mysql2", "~> #{mysql2_version}"
25
+ gem "pg", "~> #{pg_version}"
26
+ gem "sqlite3", "~> #{sqlite3_version}"
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')
16
29
  end
17
30
 
18
31
  platforms :jruby do
@@ -24,28 +37,22 @@ platforms :jruby do
24
37
  end
25
38
 
26
39
  # Support libs
27
- gem "factory_girl", "~> 4.2.0"
40
+ gem "factory_bot"
28
41
  gem "timecop"
29
42
  gem "chronic"
30
- gem "mocha"
43
+ gem "mocha", "~> 1.3.0"
31
44
 
32
45
  # Debugging
33
46
  platforms :jruby do
34
47
  gem "ruby-debug", "= 0.10.4"
35
48
  end
36
49
 
37
- platforms :mri_19 do
38
- gem "debugger"
39
- end
40
-
41
50
  platforms :ruby do
42
51
  gem "pry-byebug"
43
- gem "rb-readline"
52
+ gem "pry", "~> 0.12.0"
44
53
  end
45
54
 
46
- version = ENV['AR_VERSION'] || "4.2"
47
-
48
- if version >= "4.0"
55
+ if version >= 4.0
49
56
  gem "minitest"
50
57
  else
51
58
  gem "test-unit"
data/LICENSE CHANGED
@@ -1,56 +1,21 @@
1
- Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
- You can redistribute it and/or modify it under either the terms of the
3
- 2-clause BSDL (see the file BSDL), or the conditions below:
4
-
5
- 1. You may make and give away verbatim copies of the source form of the
6
- software without restriction, provided that you duplicate all of the
7
- original copyright notices and associated disclaimers.
8
-
9
- 2. You may modify your copy of the software in any way, provided that
10
- you do at least ONE of the following:
11
-
12
- a) place your modifications in the Public Domain or otherwise
13
- make them Freely Available, such as by posting said
14
- modifications to Usenet or an equivalent medium, or by allowing
15
- the author to include your modifications in the software.
16
-
17
- b) use the modified software only within your corporation or
18
- organization.
19
-
20
- c) give non-standard binaries non-standard names, with
21
- instructions on where to get the original software distribution.
22
-
23
- d) make other distribution arrangements with the author.
24
-
25
- 3. You may distribute the software in object code or binary form,
26
- provided that you do at least ONE of the following:
27
-
28
- a) distribute the binaries and library files of the software,
29
- together with instructions (in the manual page or equivalent)
30
- on where to get the original distribution.
31
-
32
- b) accompany the distribution with the machine-readable source of
33
- the software.
34
-
35
- c) give non-standard binaries non-standard names, with
36
- instructions on where to get the original software distribution.
37
-
38
- d) make other distribution arrangements with the author.
39
-
40
- 4. You may modify and include the part of the software into any other
41
- software (possibly commercial). But some files in the distribution
42
- are not written by the author, so that they are not under these terms.
43
-
44
- For the list of those files and their copying conditions, see the
45
- file LEGAL.
46
-
47
- 5. The scripts and library files supplied as input to or produced as
48
- output from the software do not automatically fall under the
49
- copyright of the software, but belong to whomever generated them,
50
- and may be sold commercially, and may be aggregated with this
51
- software.
52
-
53
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
- PURPOSE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Zach Dennis <zach.dennis@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.