activerecord-import 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +32 -0
- data/.rubocop.yml +49 -0
- data/.rubocop_todo.yml +36 -0
- data/.travis.yml +74 -0
- data/Brewfile +3 -0
- data/CHANGELOG.md +430 -0
- data/Gemfile +59 -0
- data/LICENSE +56 -0
- data/README.markdown +619 -0
- data/Rakefile +68 -0
- data/activerecord-import.gemspec +23 -0
- data/benchmarks/README +32 -0
- data/benchmarks/benchmark.rb +68 -0
- data/benchmarks/lib/base.rb +138 -0
- data/benchmarks/lib/cli_parser.rb +107 -0
- data/benchmarks/lib/float.rb +15 -0
- data/benchmarks/lib/mysql2_benchmark.rb +19 -0
- data/benchmarks/lib/output_to_csv.rb +19 -0
- data/benchmarks/lib/output_to_html.rb +64 -0
- data/benchmarks/models/test_innodb.rb +3 -0
- data/benchmarks/models/test_memory.rb +3 -0
- data/benchmarks/models/test_myisam.rb +3 -0
- data/benchmarks/schema/mysql_schema.rb +16 -0
- data/gemfiles/3.2.gemfile +2 -0
- data/gemfiles/4.0.gemfile +2 -0
- data/gemfiles/4.1.gemfile +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 +1 -0
- data/gemfiles/6.1.gemfile +1 -0
- data/lib/activerecord-import.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/abstract_adapter.rb +9 -0
- data/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/mysql2_adapter.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/postgresql_adapter.rb +6 -0
- data/lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb +7 -0
- data/lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb +6 -0
- data/lib/activerecord-import/adapters/abstract_adapter.rb +66 -0
- data/lib/activerecord-import/adapters/em_mysql2_adapter.rb +5 -0
- data/lib/activerecord-import/adapters/mysql2_adapter.rb +5 -0
- data/lib/activerecord-import/adapters/mysql_adapter.rb +129 -0
- data/lib/activerecord-import/adapters/postgresql_adapter.rb +217 -0
- data/lib/activerecord-import/adapters/sqlite3_adapter.rb +180 -0
- data/lib/activerecord-import/base.rb +43 -0
- data/lib/activerecord-import/import.rb +1059 -0
- data/lib/activerecord-import/mysql2.rb +7 -0
- data/lib/activerecord-import/postgresql.rb +7 -0
- data/lib/activerecord-import/sqlite3.rb +7 -0
- data/lib/activerecord-import/synchronize.rb +66 -0
- data/lib/activerecord-import/value_sets_parser.rb +77 -0
- data/lib/activerecord-import/version.rb +5 -0
- data/test/adapters/jdbcmysql.rb +1 -0
- data/test/adapters/jdbcpostgresql.rb +1 -0
- data/test/adapters/jdbcsqlite3.rb +1 -0
- data/test/adapters/makara_postgis.rb +1 -0
- data/test/adapters/mysql2.rb +1 -0
- data/test/adapters/mysql2_makara.rb +1 -0
- data/test/adapters/mysql2spatial.rb +1 -0
- data/test/adapters/postgis.rb +1 -0
- data/test/adapters/postgresql.rb +1 -0
- data/test/adapters/postgresql_makara.rb +1 -0
- data/test/adapters/seamless_database_pool.rb +1 -0
- data/test/adapters/spatialite.rb +1 -0
- data/test/adapters/sqlite3.rb +1 -0
- data/test/database.yml.sample +52 -0
- data/test/import_test.rb +903 -0
- data/test/jdbcmysql/import_test.rb +5 -0
- data/test/jdbcpostgresql/import_test.rb +4 -0
- data/test/jdbcsqlite3/import_test.rb +4 -0
- data/test/makara_postgis/import_test.rb +8 -0
- data/test/models/account.rb +3 -0
- data/test/models/alarm.rb +2 -0
- data/test/models/bike_maker.rb +7 -0
- data/test/models/book.rb +9 -0
- data/test/models/car.rb +3 -0
- data/test/models/chapter.rb +4 -0
- data/test/models/dictionary.rb +4 -0
- data/test/models/discount.rb +3 -0
- data/test/models/end_note.rb +4 -0
- data/test/models/group.rb +3 -0
- data/test/models/promotion.rb +3 -0
- data/test/models/question.rb +3 -0
- data/test/models/rule.rb +3 -0
- data/test/models/tag.rb +4 -0
- data/test/models/topic.rb +23 -0
- data/test/models/user.rb +3 -0
- data/test/models/user_token.rb +4 -0
- data/test/models/vendor.rb +7 -0
- data/test/models/widget.rb +24 -0
- data/test/mysql2/import_test.rb +5 -0
- data/test/mysql2_makara/import_test.rb +6 -0
- data/test/mysqlspatial2/import_test.rb +6 -0
- data/test/postgis/import_test.rb +8 -0
- data/test/postgresql/import_test.rb +4 -0
- data/test/schema/generic_schema.rb +194 -0
- data/test/schema/jdbcpostgresql_schema.rb +1 -0
- data/test/schema/mysql2_schema.rb +19 -0
- data/test/schema/postgis_schema.rb +1 -0
- data/test/schema/postgresql_schema.rb +47 -0
- data/test/schema/sqlite3_schema.rb +13 -0
- data/test/schema/version.rb +10 -0
- data/test/sqlite3/import_test.rb +4 -0
- data/test/support/active_support/test_case_extensions.rb +75 -0
- data/test/support/assertions.rb +73 -0
- data/test/support/factories.rb +64 -0
- data/test/support/generate.rb +29 -0
- data/test/support/mysql/import_examples.rb +98 -0
- data/test/support/postgresql/import_examples.rb +563 -0
- data/test/support/shared_examples/on_duplicate_key_ignore.rb +43 -0
- data/test/support/shared_examples/on_duplicate_key_update.rb +368 -0
- data/test/support/shared_examples/recursive_import.rb +216 -0
- data/test/support/sqlite3/import_examples.rb +231 -0
- data/test/synchronize_test.rb +41 -0
- data/test/test_helper.rb +75 -0
- data/test/travis/database.yml +66 -0
- data/test/value_sets_bytes_parser_test.rb +104 -0
- data/test/value_sets_records_parser_test.rb +32 -0
- metadata +259 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9bf4dc4ecf93b15a493cc34134158d7df3d6391b2e6c7fafbe79b630df48ea3
|
4
|
+
data.tar.gz: ab5f7f4707598308dc9a2e7d4be5816f1d5674f63cea58e48b29f6ed87fa059a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 05c4ad6281d6f0f574ee30cffed790763fb393fdf906ecc20bb8b4504f640ef9734ea1a43284f9821e543f8900aa3023bf66bcf455afcb2419e15828da618a05
|
7
|
+
data.tar.gz: cdc67be0552c3b32a980598a784964df98549a27d428b89ef3ed7385acb4c75681946e010e714770ac81ff076088c0293e26bc04bbc2e15aecd42bf86c3aecc8
|
data/.gitignore
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
*.gem
|
21
|
+
*.lock
|
22
|
+
|
23
|
+
## PROJECT::SPECIFIC
|
24
|
+
log/*.log
|
25
|
+
test.db
|
26
|
+
test/database.yml
|
27
|
+
|
28
|
+
.ruby-*
|
29
|
+
.bundle/
|
30
|
+
.redcar/
|
31
|
+
.rvmrc
|
32
|
+
docsite/
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
Lint/EndAlignment:
|
4
|
+
AlignWith: variable
|
5
|
+
|
6
|
+
Metrics/AbcSize:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Metrics/ClassLength:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Metrics/CyclomaticComplexity:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Metrics/LineLength:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/MethodLength:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Metrics/ModuleLength:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Metrics/PerceivedComplexity:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/AlignParameters:
|
28
|
+
EnforcedStyle: with_fixed_indentation
|
29
|
+
|
30
|
+
Style/ClassAndModuleChildren:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/Documentation:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/ElseAlignment:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/SpaceInsideParens:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Style/SpecialGlobalVars:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/StringLiterals:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/TrailingCommaInLiteral:
|
49
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-03-17 18:14:55 -0700 using RuboCop version 0.38.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
Lint/HandleExceptions:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/activerecord-import/base.rb'
|
13
|
+
- 'test/import_test.rb'
|
14
|
+
|
15
|
+
# Offense count: 2
|
16
|
+
Lint/RescueException:
|
17
|
+
Exclude:
|
18
|
+
- 'benchmarks/lib/cli_parser.rb'
|
19
|
+
- 'test/import_test.rb'
|
20
|
+
|
21
|
+
# Offense count: 4
|
22
|
+
# Cop supports --auto-correct.
|
23
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
24
|
+
Lint/UnusedMethodArgument:
|
25
|
+
Exclude:
|
26
|
+
- 'lib/activerecord-import/adapters/postgresql_adapter.rb'
|
27
|
+
- 'lib/activerecord-import/import.rb'
|
28
|
+
|
29
|
+
# Offense count: 2
|
30
|
+
# Cop supports --auto-correct.
|
31
|
+
# Configuration parameters: Keywords.
|
32
|
+
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW
|
33
|
+
Style/CommentAnnotation:
|
34
|
+
Exclude:
|
35
|
+
- 'benchmarks/lib/cli_parser.rb'
|
36
|
+
- 'lib/activerecord-import/import.rb'
|
data/.travis.yml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 2.5.5
|
5
|
+
|
6
|
+
env:
|
7
|
+
global:
|
8
|
+
# https://github.com/discourse/discourse/blob/master/.travis.yml
|
9
|
+
- RUBY_GC_MALLOC_LIMIT=50000000
|
10
|
+
matrix:
|
11
|
+
- AR_VERSION=5.1
|
12
|
+
- AR_VERSION=5.2
|
13
|
+
- AR_VERSION=6.0
|
14
|
+
|
15
|
+
matrix:
|
16
|
+
include:
|
17
|
+
- rvm: 2.3.8
|
18
|
+
env: AR_VERSION=3.2
|
19
|
+
- rvm: 2.3.8
|
20
|
+
env: AR_VERSION=4.0
|
21
|
+
- rvm: 2.3.8
|
22
|
+
env: AR_VERSION=4.1
|
23
|
+
- rvm: 2.3.8
|
24
|
+
env: AR_VERSION=4.2
|
25
|
+
- rvm: 2.3.8
|
26
|
+
env: AR_VERSION=5.0
|
27
|
+
|
28
|
+
fast_finish: true
|
29
|
+
|
30
|
+
addons:
|
31
|
+
postgresql: "9.5"
|
32
|
+
apt:
|
33
|
+
sources:
|
34
|
+
- travis-ci/sqlite3
|
35
|
+
- mysql-5.7-trusty
|
36
|
+
packages:
|
37
|
+
- sqlite3
|
38
|
+
- mysql-server
|
39
|
+
- mysql-client
|
40
|
+
- postgresql-9.5-postgis-2.4
|
41
|
+
|
42
|
+
before_install:
|
43
|
+
- gem update --system
|
44
|
+
- sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
|
45
|
+
- sudo mysql_upgrade
|
46
|
+
- sudo service mysql restart
|
47
|
+
|
48
|
+
before_script:
|
49
|
+
- mysql -e 'create database activerecord_import_test;'
|
50
|
+
- psql -c 'create database activerecord_import_test;' -U postgres
|
51
|
+
- psql activerecord_import_test -c 'create extension if not exists hstore;' -U postgres
|
52
|
+
- psql -c 'create extension if not exists postgis;' -U postgres
|
53
|
+
- psql -c 'create extension if not exists "uuid-ossp";' -U postgres
|
54
|
+
- cp test/travis/database.yml test/database.yml
|
55
|
+
|
56
|
+
script:
|
57
|
+
- bundle exec rake test:mysql2
|
58
|
+
- bundle exec rake test:mysql2_makara
|
59
|
+
- bundle exec rake test:mysql2spatial
|
60
|
+
- bundle exec rake test:postgis
|
61
|
+
- bundle exec rake test:postgresql
|
62
|
+
- bundle exec rake test:postgresql_makara
|
63
|
+
- bundle exec rake test:seamless_database_pool
|
64
|
+
- bundle exec rake test:spatialite
|
65
|
+
- bundle exec rake test:sqlite3
|
66
|
+
- bundle exec rubocop
|
67
|
+
|
68
|
+
dist: xenial
|
69
|
+
|
70
|
+
services:
|
71
|
+
- mysql
|
72
|
+
- postgresql
|
73
|
+
|
74
|
+
sudo: required
|
data/Brewfile
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,430 @@
|
|
1
|
+
## Changes in 1.0.3
|
2
|
+
|
3
|
+
### New Features
|
4
|
+
|
5
|
+
* Add support for ActiveRecord 6.1.0.alpha. Thanks to @imtayadeway via
|
6
|
+
\#642.
|
7
|
+
|
8
|
+
### Fixes
|
9
|
+
|
10
|
+
* Return an empty array for results instead of nil when importing empty
|
11
|
+
array. Thanks to @gyfis via \#636.
|
12
|
+
|
13
|
+
## Changes in 1.0.2
|
14
|
+
|
15
|
+
### New Features
|
16
|
+
|
17
|
+
* Add support for CockroachDB adapter. Thanks to @willie via \#605.
|
18
|
+
* Add support for ActiveRecord 6.0.0.rc1. Thanks to @madeindjs, @bill-filler,
|
19
|
+
@jkowens via \#619, \#623.
|
20
|
+
|
21
|
+
### Fixes
|
22
|
+
|
23
|
+
* Fixes NoMethodError when attempting to use nil logger. Thanks to @MattMecel,
|
24
|
+
@khiav22357.
|
25
|
+
* Fix issue validating STI models. Thanks to @thejbsmith, @jkowens via
|
26
|
+
\#626.
|
27
|
+
|
28
|
+
## Changes in 1.0.1
|
29
|
+
|
30
|
+
### Fixes
|
31
|
+
|
32
|
+
* Raise an error with a helpful message if array of values exceeds the number of
|
33
|
+
columns for a table. Thanks to @golddranks via \#589.
|
34
|
+
* Properly check if model responds to import before creating alias.
|
35
|
+
Thanks to @jcw- via \#591.
|
36
|
+
* No longer pass :returning option to child associations on recursive
|
37
|
+
import. Thanks to @dmitriy-kiriyenko via \#595.
|
38
|
+
* Fix import issue for models with Postgresql json/jsonb fields. Thanks
|
39
|
+
to @stokarenko via \#594.
|
40
|
+
* Fix issue importing models with timestamps that contain timezone
|
41
|
+
information. Thaks to @dekaikiwi, @jkowens via \#598.
|
42
|
+
* Ignore :no_returning when using :recursive option. Thanks to @dgollahon, @jkowens
|
43
|
+
via \#599.
|
44
|
+
|
45
|
+
## Changes in 1.0.0
|
46
|
+
|
47
|
+
### New Features
|
48
|
+
|
49
|
+
* Move ActiveRecord::Dirty changes to previous_changes after import.
|
50
|
+
Thanks to @stokarenko via \#584.
|
51
|
+
|
52
|
+
### Breaking Changes
|
53
|
+
|
54
|
+
* Previously :on_duplicate_key_update was enabled by default for MySQL.
|
55
|
+
The update timestamp columns (updated_at, updated_on) would be updated
|
56
|
+
on duplicate key. This was behavior is inconsistent with the other database
|
57
|
+
adapters and could also be considered surprising. Going forward it must
|
58
|
+
be explicitly enabled. See \#548.
|
59
|
+
|
60
|
+
## Changes in 0.28.2
|
61
|
+
|
62
|
+
### Fixes
|
63
|
+
|
64
|
+
* Fix issue where validations where not working in certain scenarios.
|
65
|
+
Thanks to @CASIXx1 via \#579.
|
66
|
+
|
67
|
+
## Changes in 0.28.1
|
68
|
+
|
69
|
+
### Fixes
|
70
|
+
|
71
|
+
* Fix issue where ActiveRecord presence validations were being mutated.
|
72
|
+
Limited custom presence validation to bulk imports.
|
73
|
+
|
74
|
+
## Changes in 0.28.0
|
75
|
+
|
76
|
+
### New Features
|
77
|
+
|
78
|
+
* Allow updated timestamps to be manually set.Thanks to @Rob117, @jkowens via \#570.
|
79
|
+
|
80
|
+
### Fixes
|
81
|
+
|
82
|
+
* Fix validating presence of belongs_to associations. Existence
|
83
|
+
of the parent record is not validated, but the foreign key field
|
84
|
+
cannot be empty. Thanks to @Rob117, @jkowens via \#575.
|
85
|
+
|
86
|
+
## Changes in 0.27.0
|
87
|
+
|
88
|
+
### New Features
|
89
|
+
|
90
|
+
* Add "secret" option validate_uniqueness to enable uniqueness
|
91
|
+
validators when validating import. This is not a recommended
|
92
|
+
approach (See #228), but is being added back in for projects
|
93
|
+
that depended on this feature. Thanks to @jkowens via \#554.
|
94
|
+
|
95
|
+
## Changes in 0.26.0
|
96
|
+
|
97
|
+
### New Features
|
98
|
+
|
99
|
+
* Add on_duplicate_key_update for SQLite. Thanks to @jkowens via \#542.
|
100
|
+
* Add option to update all fields on_duplicate_key_update. Thanks to @aimerald, @jkowens via \#543.
|
101
|
+
|
102
|
+
### Fixes
|
103
|
+
|
104
|
+
* Handle deeply frozen options hashes. Thanks to @jturkel via \#546.
|
105
|
+
* Switch from FactoryGirl to FactoryBot. Thanks to @koic via \#547.
|
106
|
+
* Allow import to work with ProxySQL. Thanks to @GregFarrell via \#550.
|
107
|
+
|
108
|
+
## Changes in 0.25.0
|
109
|
+
|
110
|
+
### New Features
|
111
|
+
|
112
|
+
* Add support for makara_postgis adapter. Thanks to @chadwilken via \#527.
|
113
|
+
* Skip validating presence of belongs_to associations. Thanks to @Sohair63, @naiyt, @jkowens via \#528.
|
114
|
+
|
115
|
+
### Fixes
|
116
|
+
|
117
|
+
* Add missing require for ActiveSupport.on_load. Thanks to @onk via \#529.
|
118
|
+
* Support setting attribute values in before_validation callbacks.
|
119
|
+
Thanks to @SirRawlins, @jkowens via \#531.
|
120
|
+
* Ignore virtual columns. Thanks to @dbourguignon, @jkowens via \#530.
|
121
|
+
|
122
|
+
## Changes in 0.24.0
|
123
|
+
|
124
|
+
### Fixes
|
125
|
+
|
126
|
+
* Use the association primary key when importing. Thanks to @dpogue via \#512.
|
127
|
+
* Allow association ids to be updated. Thanks to @Aristat via \#515.
|
128
|
+
|
129
|
+
## Changes in 0.23.0
|
130
|
+
|
131
|
+
### New Features
|
132
|
+
|
133
|
+
* Rename `import` method to `bulk_import` and alias to `import`. Thanks
|
134
|
+
to @itay-grudev, @jkowens via \#498.
|
135
|
+
* Increment lock_version on duplicate key update. Thanks to @aimerald
|
136
|
+
via \#500.
|
137
|
+
|
138
|
+
### Fixes
|
139
|
+
|
140
|
+
* Fix import_without_validations_or_callbacks exception if array is empty.
|
141
|
+
Thanks to @doloopwhile via \#508.
|
142
|
+
|
143
|
+
## Changes in 0.22.0
|
144
|
+
|
145
|
+
### New Features
|
146
|
+
|
147
|
+
* Add support for importing hashes thru a has many association. Thanks
|
148
|
+
to @jkowens via \#483.
|
149
|
+
|
150
|
+
### Fixes
|
151
|
+
|
152
|
+
* Fix validation logic for recursive import. For those on Rails 5.0 and 5.1,
|
153
|
+
this change requires models with polymorphic associations to specify the `inverse_of`
|
154
|
+
argument (See issue #495). Thanks to @eric-simonton-sama, @jkowens via
|
155
|
+
\#489.
|
156
|
+
|
157
|
+
## Changes in 0.21.0
|
158
|
+
|
159
|
+
### New Features
|
160
|
+
|
161
|
+
* Allow SQL subqueries (objects that respond to .to_sql) to be passed as values. Thanks
|
162
|
+
to @jalada, @jkowens via \#471
|
163
|
+
* Raise an ArgumentError when importing an array of hashes if any of the
|
164
|
+
hash objects have different keys. Thanks to @mbell697 via \#465.
|
165
|
+
|
166
|
+
### Fixes
|
167
|
+
|
168
|
+
* Fix issue loading incorrect foreign key value when syncing belongs_to
|
169
|
+
associations with custom foreign key columns. Thanks to @marcgreenstock, @jkowens via \#470.
|
170
|
+
* Fix issue importing models with polymorphic belongs_to associations.
|
171
|
+
Thanks to @zorab47, @jkowens via \#476.
|
172
|
+
* Fix issue importing STI models with ActiveRecord 4.0. Thanks to
|
173
|
+
@kazuki-st, @jkowens via \#478.
|
174
|
+
|
175
|
+
## Changes in 0.20.2
|
176
|
+
|
177
|
+
### Fixes
|
178
|
+
|
179
|
+
* Unscope model when synchronizing with database. Thanks to @indigoviolet via \#455.
|
180
|
+
|
181
|
+
## Changes in 0.20.1
|
182
|
+
|
183
|
+
### Fixes
|
184
|
+
|
185
|
+
* Prevent :on_duplicate_key_update args from being modified. Thanks to @joshuamcginnis, @jkowens via \#451.
|
186
|
+
|
187
|
+
## Changes in 0.20.0
|
188
|
+
|
189
|
+
### New Features
|
190
|
+
|
191
|
+
* Allow returning columns to be specified for PostgreSQL. Thanks to
|
192
|
+
@tjwp via \#433.
|
193
|
+
|
194
|
+
### Fixes
|
195
|
+
|
196
|
+
* Fixes an issue when bypassing uniqueness validators. Thanks to @vmaxv via \#444.
|
197
|
+
* For AR < 4.2, prevent type casting for binary columns on Postgresql. Thanks to @mwalsher via \#446.
|
198
|
+
* Fix issue logging class name on import. Thanks to @sophylee, @jkowens via \#447.
|
199
|
+
* Copy belongs_to association id to foreign key column before importing. Thanks to @jkowens via \#448.
|
200
|
+
* Reset model instance on validate. Thanks to @vmaxv via \#449.
|
201
|
+
|
202
|
+
## Changes in 0.19.1
|
203
|
+
|
204
|
+
### Fixes
|
205
|
+
|
206
|
+
* Fix a regression where models weren't properly being marked clean. Thanks to @tjwp via \#434.
|
207
|
+
* Raise ActiveRecord::Import::ValueSetTooLargeError when a record being inserted exceeds the
|
208
|
+
`max_allowed_packet` for MySQL. Thanks to @saizai, @jkowens via \#437.
|
209
|
+
* Fix issue concatenating column names array with primary key. Thanks to @keeguon via \#440.
|
210
|
+
|
211
|
+
## Changes in 0.19.0
|
212
|
+
|
213
|
+
### New Features
|
214
|
+
|
215
|
+
* For PostgreSQL, add option to set WHERE condition in conflict_action. Thanks to
|
216
|
+
@Saidbek via \#423.
|
217
|
+
|
218
|
+
### Fixes
|
219
|
+
|
220
|
+
* Fix issue importing saved records with serialized fields. Thanks to
|
221
|
+
@Andreis13, @jkowens via \#425.
|
222
|
+
* Fix issue importing records that have columns defined with default values
|
223
|
+
that are functions or expressions. Thanks to @Andreis13, @jkowens via \#428.
|
224
|
+
|
225
|
+
## Changes in 0.18.3
|
226
|
+
|
227
|
+
### Fixes
|
228
|
+
|
229
|
+
* Set models new_record attribute to false when importing with
|
230
|
+
:on_duplicate_key_ignore. Thanks to @nijikon, @jkowens via \#416.
|
231
|
+
|
232
|
+
## Changes in 0.18.2
|
233
|
+
|
234
|
+
### Fixes
|
235
|
+
|
236
|
+
* Enable custom validate callbacks when validating import. Thanks to @afn via \#410.
|
237
|
+
* Prevent wrong IDs being set on models when using :on_duplicate_key_ignore.
|
238
|
+
Thanks to @afn, @jkowens via \#412.
|
239
|
+
|
240
|
+
## Changes in 0.18.1
|
241
|
+
|
242
|
+
### Fixes
|
243
|
+
|
244
|
+
* Fix to enable validation callbacks (before_validation,
|
245
|
+
after_validation). Thanks to @sinsoku, @jkowens via \#406.
|
246
|
+
|
247
|
+
## Changes in 0.18.0
|
248
|
+
|
249
|
+
### New Features
|
250
|
+
|
251
|
+
* Uniqueness validation is bypassed when validating models since
|
252
|
+
it cannot be guaranteed if there are duplicates in a batch.
|
253
|
+
Thanks to @jkowens via \#301.
|
254
|
+
* Allow for custom timestamp columns. Thanks to @mojidabckuu, @jkowens
|
255
|
+
via \#401.
|
256
|
+
|
257
|
+
### Fixes
|
258
|
+
|
259
|
+
* Fix ActiveRecord 5 issue coercing boolean values when serializing
|
260
|
+
for the database. Thanks to @rjrobinson, @jkowens via \#403.
|
261
|
+
|
262
|
+
## Changes in 0.17.2
|
263
|
+
|
264
|
+
### Fixes
|
265
|
+
|
266
|
+
* Fix issue where PostgreSQL cannot recognize columns if names
|
267
|
+
include mixed case characters. Thanks to @hugobgranja via \#379.
|
268
|
+
* Fix an issue for ActiveRecord 5 where serialized fields with
|
269
|
+
default values were not being typecast. Thanks to @whistlerbrk,
|
270
|
+
@jkowens via \#386.
|
271
|
+
* Add option :force_single_insert for MySQL to make sure a single
|
272
|
+
insert is attempted instead of performing multiple inserts based
|
273
|
+
on max_allowed_packet. Thanks to @mtparet via \#387.
|
274
|
+
|
275
|
+
## Changes in 0.17.1
|
276
|
+
|
277
|
+
### Fixes
|
278
|
+
|
279
|
+
* Along with setting id on models for adapters that support it,
|
280
|
+
add created_at and updated_at timestamps. Thanks to @jacob-carlborg
|
281
|
+
via \#364.
|
282
|
+
* Properly set returned ids when using composite_primary_keys.
|
283
|
+
Thanks to @guigs, @jkowens via \#371.
|
284
|
+
|
285
|
+
## Changes in 0.17.0
|
286
|
+
|
287
|
+
### New Features
|
288
|
+
|
289
|
+
* Add support for composite_primary_keys gem. Thanks to @jkowens
|
290
|
+
via \#350.
|
291
|
+
* Add support for importing an array of hashes. Thanks to @jkowens
|
292
|
+
via \#352.
|
293
|
+
* Add JDBC SQLite3 support. Thanks to @jkowens via \#356.
|
294
|
+
|
295
|
+
### Fixes
|
296
|
+
|
297
|
+
* Remove support for SQLite recursive imports. See \#351.
|
298
|
+
* Improve import speed for Rails 5. Thanks to @ranchodeluxe, @jkowens
|
299
|
+
via \#359.
|
300
|
+
|
301
|
+
## Changes in 0.16.2
|
302
|
+
|
303
|
+
### Fixes
|
304
|
+
|
305
|
+
* Fixes issue clearing query cache on wrong connection when using
|
306
|
+
multiple databases. Thanks to @KentoMoriwaki via \#337
|
307
|
+
* Raises an ArgumentError on incorrect usage of nested arrays. Thanks
|
308
|
+
to @Nitrodist via \#340
|
309
|
+
* Fixes issue that prevented uuid primary keys from being set manually.
|
310
|
+
Thanks to @Dclusin-og, @jkowens via \#342
|
311
|
+
|
312
|
+
## Changes in 0.16.1
|
313
|
+
|
314
|
+
### Fixes
|
315
|
+
|
316
|
+
* Fixes issue with missing error messages on failed instances when
|
317
|
+
importing using arrays of columns and values. Thanks to @Fivell via \#332
|
318
|
+
* Update so SQLite only return ids if table has a primary key field via \#333
|
319
|
+
|
320
|
+
|
321
|
+
## Changes in 0.16.0
|
322
|
+
|
323
|
+
### New Features
|
324
|
+
|
325
|
+
* Add partial index upsert support for PostgreSQL. Thanks to @luislew via \#305
|
326
|
+
* Add UUID primary key support for PostgreSQL. Thanks to @jkowens via
|
327
|
+
\#312
|
328
|
+
* Add store accessor support for JSON, JSON, and HSTORE data types.
|
329
|
+
Thanks to @jkowens via \#322
|
330
|
+
* Log warning if database does not support :on_duplicate_key_update.
|
331
|
+
Thanks to @jkowens via \#324
|
332
|
+
* Add option :on_duplicate_key_ignore for MySQL and SQLite. Thanks to
|
333
|
+
@jkowens via \#326
|
334
|
+
|
335
|
+
### Fixes
|
336
|
+
|
337
|
+
* Fixes issue with recursive import using same primary key for all models.
|
338
|
+
Thanks to @chopraanmol1 via \#309
|
339
|
+
* Fixes issue importing from STI subclass with polymorphic associations.
|
340
|
+
Thanks to @JNajera via \#314
|
341
|
+
* Fixes issue setting returned IDs to wrong models when some fail validation. Also fixes issue with SQLite returning wrong IDs. Thanks to @mizukami234 via \#315
|
342
|
+
|
343
|
+
|
344
|
+
## Changes in 0.15.0
|
345
|
+
|
346
|
+
### New Features
|
347
|
+
|
348
|
+
* An ArgumentError is now raised if when no `conflict_target` or `conflict_name` is provided or can be determined when using the `on_duplicate_key_update` option for PostgreSQL. Thanks to @jkowens via \#290
|
349
|
+
* Support for Rails 5.0 final release for all except the JDBC driver which is not yet updated to support Rails 5.0
|
350
|
+
|
351
|
+
### Fixes
|
352
|
+
|
353
|
+
* activerecord-import no longer modifies a value array inside of the given values array when called with `import(columns, values)`. Thanks to @jkowens via \#291
|
354
|
+
|
355
|
+
### Misc
|
356
|
+
|
357
|
+
* `raise_error` is used to raise errors for ActiveRecord 5.0. Thanks to @couragecourag via \#294 `raise_record_invalid` has been
|
358
|
+
|
359
|
+
|
360
|
+
## Changes in 0.14.1
|
361
|
+
|
362
|
+
### Fixes
|
363
|
+
|
364
|
+
* JRuby/JDBCDriver with PostgreSQL will no longer raise a JDBCDriver error when using the :no_returning boolean option. Thanks to @jkowens via \#287
|
365
|
+
|
366
|
+
## Changes in 0.14.0
|
367
|
+
|
368
|
+
### New Features
|
369
|
+
|
370
|
+
* Support for ActiveRecord 3.1 has been dropped. Thanks to @sferik via \#254
|
371
|
+
* SQLite3 has learned the :recursive option. Thanks to @jkowens via \#281
|
372
|
+
* :on_duplicate_key_ignore will be ignored when imports are being done with :recursive. Thanks to @jkowens via \#268
|
373
|
+
* :activerecord-import learned how to tell PostgreSQL to return no data back from the import via the :no_returning boolean option. Thanks to @makaroni4 via \#276
|
374
|
+
|
375
|
+
### Fixes
|
376
|
+
|
377
|
+
* Polymorphic associations will not import the :type column. Thanks to @seanlinsley via \#282 and \#283
|
378
|
+
* ~2X speed increase for importing models with validations. Thanks to @jkowens via \#266
|
379
|
+
|
380
|
+
### Misc
|
381
|
+
|
382
|
+
* Benchmark HTML report has been fixed. Thanks to @jkowens via \#264
|
383
|
+
* seamless_database_pool has been updated to work with AR 5.0. Thanks to @jkowens via \#280
|
384
|
+
* Code cleanup, removal of redundant condition checks. Thanks to @pavlik4k via \#273
|
385
|
+
* Code cleanup, removal of deprecated `alias_method_chain`. Thanks to @codeodor via \#271
|
386
|
+
|
387
|
+
|
388
|
+
## Changes in 0.13.0
|
389
|
+
|
390
|
+
### New Features
|
391
|
+
|
392
|
+
* Addition of :batch_size option to control the number of rows to insert per INSERT statement. The default is the total number of records being inserted so there is a single INSERT statement. Thanks to @jkowens via \#245
|
393
|
+
|
394
|
+
* Addition `import!` which will raise an exception if a validation occurs. It will fail fast. Thanks to @jkowens via \#246
|
395
|
+
|
396
|
+
### Fixes
|
397
|
+
|
398
|
+
* Fixing issue with recursive import when utilizing the `:on_duplicate_key_update` option. The `on_duplicate_key_update` only applies to parent models at this time. Thanks to @yuri-karpovich for reporting and @jkowens for fixing via \#249
|
399
|
+
|
400
|
+
### Misc
|
401
|
+
|
402
|
+
* Refactoring of fetching and assigning attributes. Thanks to @jkownes via \#259
|
403
|
+
* Lots of code cleanup and addition of Rubocop linter. Thanks to @sferik via \#256 and \#250
|
404
|
+
* Resolving errors with the test suite when running against ActiveRecord 4.0 and 4.1. Thanks to @jkowens via \#262
|
405
|
+
* Cleaning up the TravisCI settings and packages. Thanks to @sferik via \#258 and \#251
|
406
|
+
|
407
|
+
## Changes in 0.12.0
|
408
|
+
|
409
|
+
### New Features
|
410
|
+
|
411
|
+
* PostgreSQL UPSERT support has been added. Thanks @jkowens via \#218
|
412
|
+
|
413
|
+
### Fixes
|
414
|
+
|
415
|
+
* has_one and has_many associations will now be recursively imported regardless of :autosave being set. Thanks @sferik, @jkowens via \#243, \#234
|
416
|
+
* Fixing an issue with enum column support for Rails > 4.1. Thanks @aquajach via \#235
|
417
|
+
|
418
|
+
### Removals
|
419
|
+
|
420
|
+
* Support for em-synchrony has been removed since it appears the project has been abandoned. Thanks @sferik, @zdennis via \#239
|
421
|
+
* Support for the mysql gem/adapter has been removed since it has officially been abandoned. Use the mysql2 gem/adapter instead. Thanks @sferik, @zdennis via \#239
|
422
|
+
|
423
|
+
### Misc
|
424
|
+
|
425
|
+
* Cleaned up TravisCI output and removing deprecation warnings. Thanks @jkowens, @zdennis \#242
|
426
|
+
|
427
|
+
|
428
|
+
## Changes before 0.12.0
|
429
|
+
|
430
|
+
> Never look back. What's gone is now history. But in the process make memory of events to help you understand what will help you to make your dream a true story. Mistakes of the past are lessons, success of the past is inspiration. – Dr. Anil Kr Sinha
|