activerecord-import 0.27.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 (129) 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 +175 -2
  7. data/Gemfile +13 -9
  8. data/LICENSE +21 -56
  9. data/README.markdown +525 -21
  10. data/Rakefile +2 -0
  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 +2 -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 +9 -1
  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 +10 -11
  42. data/lib/activerecord-import/adapters/postgresql_adapter.rb +49 -38
  43. data/lib/activerecord-import/adapters/sqlite3_adapter.rb +21 -25
  44. data/lib/activerecord-import/base.rb +11 -2
  45. data/lib/activerecord-import/import.rb +180 -78
  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 +3 -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 +2 -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 +138 -4
  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 +2 -0
  72. data/test/models/account.rb +2 -0
  73. data/test/models/alarm.rb +2 -0
  74. data/test/models/animal.rb +8 -0
  75. data/test/models/bike_maker.rb +2 -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 +2 -0
  95. data/test/models/user_token.rb +3 -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 +33 -0
  104. data/test/schema/jdbcpostgresql_schema.rb +2 -0
  105. data/test/schema/mysql2_schema.rb +2 -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 +2 -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 +2 -0
  114. data/test/support/generate.rb +4 -2
  115. data/test/support/mysql/import_examples.rb +2 -1
  116. data/test/support/postgresql/import_examples.rb +115 -2
  117. data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
  118. data/test/support/shared_examples/on_duplicate_key_update.rb +32 -0
  119. data/test/support/shared_examples/recursive_import.rb +61 -1
  120. data/test/support/sqlite3/import_examples.rb +4 -16
  121. data/test/synchronize_test.rb +2 -0
  122. data/test/test_helper.rb +27 -2
  123. data/test/value_sets_bytes_parser_test.rb +2 -0
  124. data/test/value_sets_records_parser_test.rb +2 -0
  125. metadata +29 -16
  126. data/.travis.yml +0 -71
  127. data/gemfiles/3.2.gemfile +0 -2
  128. data/gemfiles/4.0.gemfile +0 -2
  129. data/gemfiles/4.1.gemfile +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00e3b31f9b8fbe29c0ed8b6a58b6a1afeb0a3f67
4
- data.tar.gz: b854ffc00c14c4cfc64a67819a367b35941cdb80
2
+ SHA256:
3
+ metadata.gz: 1b9c717d31cf5a4012568c9d8497947466408be7fef5610fba9143f7a911ed7c
4
+ data.tar.gz: 925bc5f645152eeb09f9583e9d50b9be67c4bfa8049c303571f82649262e4d5b
5
5
  SHA512:
6
- metadata.gz: 164ff30dd1c1f19becb91dd2e7c0d3c9d022489b5065a337743b5eb84a497e58dd6ddaee43a401127cf06c60f3320d4501c962dd91885127b86acea4542315d9
7
- data.tar.gz: 0dad63cbd8a90ee1f31483796a470088cbd4f35eca9579f707e394500ab6e2ab9524150e49d3a2bee60b79b367c8974855dd5af413c33b326ed4796d0852e118
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,176 @@
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
+
1
174
  ## Changes in 0.27.0
2
175
 
3
176
  ### New Features
@@ -168,7 +341,7 @@
168
341
  Thanks to @jkowens via \#301.
169
342
  * Allow for custom timestamp columns. Thanks to @mojidabckuu, @jkowens
170
343
  via \#401.
171
-
344
+
172
345
  ### Fixes
173
346
 
174
347
  * Fix ActiveRecord 5 issue coercing boolean values when serializing
@@ -180,7 +353,7 @@
180
353
 
181
354
  * Fix issue where PostgreSQL cannot recognize columns if names
182
355
  include mixed case characters. Thanks to @hugobgranja via \#379.
183
- * Fix an issue for ActiveRecord 5 where serialized fields with
356
+ * Fix an issue for ActiveRecord 5 where serialized fields with
184
357
  default values were not being typecast. Thanks to @whistlerbrk,
185
358
  @jkowens via \#386.
186
359
  * Add option :force_single_insert for MySQL to make sure a single
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
@@ -6,18 +8,24 @@ version = ENV['AR_VERSION'].to_f
6
8
 
7
9
  mysql2_version = '0.3.0'
8
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
9
16
 
10
17
  group :development, :test do
11
- gem 'rubocop', '~> 0.40.0'
18
+ gem 'rubocop', '~> 0.71.0'
12
19
  gem 'rake'
13
20
  end
14
21
 
15
22
  # Database Adapters
16
23
  platforms :ruby do
17
24
  gem "mysql2", "~> #{mysql2_version}"
18
- gem "pg", "~> 0.9"
19
- gem "sqlite3", "~> 1.3.10"
20
- gem "seamless_database_pool", "~> 1.0.20"
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')
21
29
  end
22
30
 
23
31
  platforms :jruby do
@@ -39,13 +47,9 @@ platforms :jruby do
39
47
  gem "ruby-debug", "= 0.10.4"
40
48
  end
41
49
 
42
- platforms :mri_19 do
43
- gem "debugger"
44
- end
45
-
46
50
  platforms :ruby do
47
51
  gem "pry-byebug"
48
- gem "rb-readline"
52
+ gem "pry", "~> 0.12.0"
49
53
  end
50
54
 
51
55
  if version >= 4.0
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.