activerecord-import 1.0.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yaml +159 -0
  3. data/.gitignore +5 -0
  4. data/.rubocop.yml +76 -7
  5. data/.rubocop_todo.yml +10 -16
  6. data/Brewfile +3 -1
  7. data/CHANGELOG.md +143 -3
  8. data/Dockerfile +23 -0
  9. data/Gemfile +28 -24
  10. data/LICENSE +21 -56
  11. data/README.markdown +83 -27
  12. data/Rakefile +3 -0
  13. data/activerecord-import.gemspec +10 -5
  14. data/benchmarks/benchmark.rb +10 -6
  15. data/benchmarks/lib/base.rb +10 -5
  16. data/benchmarks/lib/cli_parser.rb +10 -6
  17. data/benchmarks/lib/float.rb +2 -0
  18. data/benchmarks/lib/mysql2_benchmark.rb +2 -0
  19. data/benchmarks/lib/output_to_csv.rb +2 -0
  20. data/benchmarks/lib/output_to_html.rb +4 -2
  21. data/benchmarks/models/test_innodb.rb +2 -0
  22. data/benchmarks/models/test_memory.rb +2 -0
  23. data/benchmarks/models/test_myisam.rb +2 -0
  24. data/benchmarks/schema/{mysql_schema.rb → mysql2_schema.rb} +2 -0
  25. data/docker-compose.yml +34 -0
  26. data/gemfiles/5.2.gemfile +2 -0
  27. data/gemfiles/6.0.gemfile +3 -0
  28. data/gemfiles/6.1.gemfile +4 -1
  29. data/gemfiles/7.0.gemfile +4 -0
  30. data/gemfiles/7.1.gemfile +3 -0
  31. data/gemfiles/7.2.gemfile +3 -0
  32. data/gemfiles/8.0.gemfile +3 -0
  33. data/lib/activerecord-import/active_record/adapters/abstract_adapter.rb +2 -0
  34. data/lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb +6 -4
  35. data/lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb +2 -0
  36. data/lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb +2 -0
  37. data/lib/activerecord-import/active_record/adapters/mysql2_adapter.rb +2 -0
  38. data/lib/activerecord-import/active_record/adapters/postgresql_adapter.rb +2 -0
  39. data/lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb +2 -0
  40. data/lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb +2 -0
  41. data/lib/activerecord-import/active_record/adapters/trilogy_adapter.rb +8 -0
  42. data/lib/activerecord-import/adapters/abstract_adapter.rb +9 -6
  43. data/lib/activerecord-import/adapters/em_mysql2_adapter.rb +2 -0
  44. data/lib/activerecord-import/adapters/mysql2_adapter.rb +2 -0
  45. data/lib/activerecord-import/adapters/mysql_adapter.rb +30 -21
  46. data/lib/activerecord-import/adapters/postgresql_adapter.rb +68 -48
  47. data/lib/activerecord-import/adapters/sqlite3_adapter.rb +37 -30
  48. data/lib/activerecord-import/adapters/trilogy_adapter.rb +7 -0
  49. data/lib/activerecord-import/base.rb +3 -1
  50. data/lib/activerecord-import/import.rb +160 -58
  51. data/lib/activerecord-import/synchronize.rb +3 -1
  52. data/lib/activerecord-import/value_sets_parser.rb +5 -0
  53. data/lib/activerecord-import/version.rb +3 -1
  54. data/lib/activerecord-import.rb +2 -1
  55. data/test/adapters/jdbcmysql.rb +2 -0
  56. data/test/adapters/jdbcpostgresql.rb +2 -0
  57. data/test/adapters/jdbcsqlite3.rb +2 -0
  58. data/test/adapters/makara_postgis.rb +2 -0
  59. data/test/adapters/mysql2.rb +2 -0
  60. data/test/adapters/mysql2_makara.rb +2 -0
  61. data/test/adapters/mysql2spatial.rb +2 -0
  62. data/test/adapters/postgis.rb +2 -0
  63. data/test/adapters/postgresql.rb +2 -0
  64. data/test/adapters/postgresql_makara.rb +2 -0
  65. data/test/adapters/seamless_database_pool.rb +2 -0
  66. data/test/adapters/spatialite.rb +2 -0
  67. data/test/adapters/sqlite3.rb +2 -0
  68. data/test/adapters/trilogy.rb +9 -0
  69. data/test/database.yml.sample +7 -0
  70. data/test/{travis → github}/database.yml +9 -3
  71. data/test/import_test.rb +108 -41
  72. data/test/jdbcmysql/import_test.rb +5 -3
  73. data/test/jdbcpostgresql/import_test.rb +4 -2
  74. data/test/jdbcsqlite3/import_test.rb +4 -2
  75. data/test/makara_postgis/import_test.rb +4 -2
  76. data/test/models/account.rb +2 -0
  77. data/test/models/alarm.rb +2 -0
  78. data/test/models/animal.rb +8 -0
  79. data/test/models/author.rb +9 -0
  80. data/test/models/bike_maker.rb +3 -0
  81. data/test/models/book.rb +12 -3
  82. data/test/models/car.rb +2 -0
  83. data/test/models/card.rb +5 -0
  84. data/test/models/chapter.rb +2 -0
  85. data/test/models/composite_book.rb +19 -0
  86. data/test/models/composite_chapter.rb +12 -0
  87. data/test/models/customer.rb +18 -0
  88. data/test/models/deck.rb +8 -0
  89. data/test/models/dictionary.rb +2 -0
  90. data/test/models/discount.rb +2 -0
  91. data/test/models/end_note.rb +2 -0
  92. data/test/models/group.rb +2 -0
  93. data/test/models/order.rb +17 -0
  94. data/test/models/playing_card.rb +4 -0
  95. data/test/models/promotion.rb +2 -0
  96. data/test/models/question.rb +2 -0
  97. data/test/models/rule.rb +2 -0
  98. data/test/models/tag.rb +9 -1
  99. data/test/models/tag_alias.rb +11 -0
  100. data/test/models/topic.rb +8 -0
  101. data/test/models/user.rb +2 -0
  102. data/test/models/user_token.rb +2 -0
  103. data/test/models/vendor.rb +2 -0
  104. data/test/models/widget.rb +12 -3
  105. data/test/mysql2/import_test.rb +5 -3
  106. data/test/mysql2_makara/import_test.rb +5 -3
  107. data/test/mysqlspatial2/import_test.rb +5 -3
  108. data/test/postgis/import_test.rb +4 -2
  109. data/test/postgresql/import_test.rb +4 -2
  110. data/test/schema/generic_schema.rb +37 -1
  111. data/test/schema/jdbcpostgresql_schema.rb +3 -1
  112. data/test/schema/mysql2_schema.rb +2 -0
  113. data/test/schema/postgis_schema.rb +3 -1
  114. data/test/schema/postgresql_schema.rb +38 -4
  115. data/test/schema/sqlite3_schema.rb +2 -0
  116. data/test/schema/version.rb +2 -0
  117. data/test/sqlite3/import_test.rb +4 -2
  118. data/test/support/active_support/test_case_extensions.rb +3 -5
  119. data/test/support/assertions.rb +2 -0
  120. data/test/support/factories.rb +2 -0
  121. data/test/support/generate.rb +4 -2
  122. data/test/support/mysql/import_examples.rb +7 -8
  123. data/test/support/postgresql/import_examples.rb +121 -53
  124. data/test/support/shared_examples/on_duplicate_key_ignore.rb +2 -0
  125. data/test/support/shared_examples/on_duplicate_key_update.rb +69 -10
  126. data/test/support/shared_examples/recursive_import.rb +137 -1
  127. data/test/support/sqlite3/import_examples.rb +2 -1
  128. data/test/synchronize_test.rb +2 -0
  129. data/test/test_helper.rb +38 -24
  130. data/test/trilogy/import_test.rb +7 -0
  131. data/test/value_sets_bytes_parser_test.rb +3 -1
  132. data/test/value_sets_records_parser_test.rb +3 -1
  133. metadata +46 -22
  134. data/.travis.yml +0 -74
  135. data/gemfiles/3.2.gemfile +0 -2
  136. data/gemfiles/4.0.gemfile +0 -2
  137. data/gemfiles/4.1.gemfile +0 -2
  138. data/gemfiles/4.2.gemfile +0 -2
  139. data/gemfiles/5.0.gemfile +0 -2
  140. data/gemfiles/5.1.gemfile +0 -2
  141. data/lib/activerecord-import/mysql2.rb +0 -7
  142. data/lib/activerecord-import/postgresql.rb +0 -7
  143. data/lib/activerecord-import/sqlite3.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbf4c01d6a3f043ed541f7331d6a19e651cbc035fcc3030b17f1e741a6d4e8b7
4
- data.tar.gz: a740491de16c78d4d94ccb428c69342fd8a809f235ce9d42fc41237a4d15c7e6
3
+ metadata.gz: f55c9faf85e948fbeb480ebca5baeca11b2275a626bc6ba7517e9d3e8c37e9e7
4
+ data.tar.gz: 80b267b08ef3a10bb91b029401e8fb6b49fdfcadeeb29a2e5e18fd6c8f529192
5
5
  SHA512:
6
- metadata.gz: 48e62637f6493cd5446cd78aee3db3b4a58e646fb0bc07d3583a662f89f52b03c2a079c83fc2cae807c5577f922e1e3219354cf36dff8ae8cc81ae68266e711f
7
- data.tar.gz: 2f40f5fd61975589f8af932a3dbf5b6d14d2cfc6884ebe7019c85956c8c380d3faebffb1b600a7fa04536fe262ed40688946c8d35b8cf5b1bfedd1ddff20af5a
6
+ metadata.gz: f838da07331afe7827ad7d4f323ebf3f2191decd59a82359393f20eee866345258abb979875dd1c9b853533099797cdf7599ded20ca4e07997f8bce491f4c03e
7
+ data.tar.gz: 5a257bacb43492f25a65ecc382fe8ad126c4dac474eae7ee2beb3ba92c2cb95e64070a40cd20c48e47f46b51e64b69c2addd76a15fed75863df2ecb4a0fbdb70
@@ -0,0 +1,159 @@
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
+ mysql:
20
+ image: mysql:5.7
21
+ ports:
22
+ - 3306:3306
23
+ env:
24
+ MYSQL_HOST: 127.0.0.1
25
+ MYSQL_ROOT_PASSWORD: root
26
+ MYSQL_USER: github
27
+ MYSQL_PASSWORD: github
28
+ MYSQL_DATABASE: activerecord_import_test
29
+ options: >-
30
+ --health-cmd "mysqladmin ping -h localhost"
31
+ --health-interval 10s
32
+ --health-timeout 5s
33
+ --health-retries 5
34
+ strategy:
35
+ fail-fast: false
36
+ matrix:
37
+ ruby:
38
+ - 3.3
39
+ env:
40
+ - AR_VERSION: '8.0'
41
+ RUBYOPT: --enable-frozen-string-literal
42
+ - AR_VERSION: '7.2'
43
+ RUBYOPT: --enable-frozen-string-literal
44
+ - AR_VERSION: '7.1'
45
+ RUBYOPT: --enable-frozen-string-literal
46
+ - AR_VERSION: '7.0'
47
+ RUBYOPT: --enable-frozen-string-literal
48
+ - AR_VERSION: 6.1
49
+ RUBYOPT: --enable-frozen-string-literal
50
+ include:
51
+ - ruby: 3.2
52
+ env:
53
+ AR_VERSION: '8.0'
54
+ - ruby: 3.2
55
+ env:
56
+ AR_VERSION: '7.2'
57
+ - ruby: 3.2
58
+ env:
59
+ AR_VERSION: '7.1'
60
+ - ruby: 3.2
61
+ env:
62
+ AR_VERSION: '7.0'
63
+ - ruby: 3.2
64
+ env:
65
+ AR_VERSION: 6.1
66
+ - ruby: 3.1
67
+ env:
68
+ AR_VERSION: '7.1'
69
+ - ruby: 3.1
70
+ env:
71
+ AR_VERSION: '7.0'
72
+ - ruby: 3.1
73
+ env:
74
+ AR_VERSION: 6.1
75
+ - ruby: '3.0'
76
+ env:
77
+ AR_VERSION: '7.0'
78
+ - ruby: '3.0'
79
+ env:
80
+ AR_VERSION: 6.1
81
+ - ruby: jruby-9.4.8.0
82
+ env:
83
+ AR_VERSION: '7.0'
84
+ - ruby: 2.7
85
+ env:
86
+ AR_VERSION: '7.0'
87
+ - ruby: 2.7
88
+ env:
89
+ AR_VERSION: 6.1
90
+ - ruby: 2.7
91
+ env:
92
+ AR_VERSION: '6.0'
93
+ - ruby: jruby-9.3.15.0
94
+ env:
95
+ AR_VERSION: '6.1'
96
+ - ruby: 2.6
97
+ env:
98
+ AR_VERSION: 5.2
99
+ runs-on: ubuntu-latest
100
+ env:
101
+ AR_VERSION: ${{ matrix.env.AR_VERSION }}
102
+ DB_DATABASE: activerecord_import_test
103
+ steps:
104
+ - uses: actions/checkout@v4
105
+ - name: Install SQLite3 Development Library
106
+ run: |
107
+ sudo apt-get update
108
+ sudo apt-get install libsqlite3-dev
109
+ - uses: ruby/setup-ruby@v1
110
+ with:
111
+ ruby-version: ${{ matrix.ruby }}
112
+ bundler-cache: true
113
+ rubygems: latest
114
+ - name: Set up databases
115
+ run: |
116
+ psql -h localhost -U postgres -c 'create database ${{ env.DB_DATABASE }};'
117
+ psql -h localhost -U postgres -d ${{ env.DB_DATABASE }} -c 'create extension if not exists hstore;'
118
+ psql -h localhost -U postgres -c 'create extension if not exists postgis;'
119
+ psql -h localhost -U postgres -c 'create extension if not exists "uuid-ossp";'
120
+ cp test/github/database.yml test/database.yml
121
+ env:
122
+ PGPASSWORD: postgres
123
+ - name: Run tests with mysql2
124
+ run: |
125
+ bundle exec rake test:mysql2
126
+ bundle exec rake test:mysql2_makara
127
+ bundle exec rake test:mysql2spatial
128
+ - name: Run tests with postgresql
129
+ run: |
130
+ bundle exec rake test:postgis
131
+ bundle exec rake test:postgresql
132
+ bundle exec rake test:postgresql_makara
133
+ - name: Run tests with seamless_database_pool
134
+ run: |
135
+ bundle exec rake test:seamless_database_pool
136
+ if: ${{ matrix.ruby < '3.0' }}
137
+ - name: Run tests with sqlite
138
+ run: |
139
+ bundle exec rake test:spatialite
140
+ bundle exec rake test:sqlite3
141
+ - name: Run trilogy tests
142
+ if: ${{ matrix.env.AR_VERSION >= '7.0' && !startsWith(matrix.ruby, 'jruby') }}
143
+ run: bundle exec rake test:trilogy
144
+ lint:
145
+ runs-on: ubuntu-latest
146
+ env:
147
+ AR_VERSION: '7.0'
148
+ steps:
149
+ - uses: actions/checkout@v4
150
+ - name: Install SQLite3 Development Library
151
+ run: |
152
+ sudo apt-get update
153
+ sudo apt-get install libsqlite3-dev
154
+ - uses: ruby/setup-ruby@v1
155
+ with:
156
+ ruby-version: 3.0
157
+ bundler-cache: true
158
+ - name: Run Rubocop
159
+ run: bundle exec rubocop
data/.gitignore CHANGED
@@ -13,17 +13,22 @@ tmtags
13
13
  ## VIM
14
14
  *.swp
15
15
 
16
+ ## Idea
17
+ .idea
18
+
16
19
  ## PROJECT::GENERAL
17
20
  coverage
18
21
  rdoc
19
22
  pkg
20
23
  *.gem
21
24
  *.lock
25
+ .byebug_history
22
26
 
23
27
  ## PROJECT::SPECIFIC
24
28
  log/*.log
25
29
  test.db
26
30
  test/database.yml
31
+ benchmarks/log/
27
32
 
28
33
  .ruby-*
29
34
  .bundle/
data/.rubocop.yml CHANGED
@@ -1,11 +1,14 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- Lint/EndAlignment:
4
- AlignWith: variable
3
+ AllCops:
4
+ TargetRubyVersion: 3.0.x
5
5
 
6
6
  Metrics/AbcSize:
7
7
  Enabled: false
8
8
 
9
+ Metrics/BlockLength:
10
+ Enabled: false
11
+
9
12
  Metrics/ClassLength:
10
13
  Enabled: false
11
14
 
@@ -24,8 +27,8 @@ Metrics/ModuleLength:
24
27
  Metrics/PerceivedComplexity:
25
28
  Enabled: false
26
29
 
27
- Style/AlignParameters:
28
- EnforcedStyle: with_fixed_indentation
30
+ Style/CommentedKeyword:
31
+ Enabled: false
29
32
 
30
33
  Style/ClassAndModuleChildren:
31
34
  Enabled: false
@@ -33,10 +36,25 @@ Style/ClassAndModuleChildren:
33
36
  Style/Documentation:
34
37
  Enabled: false
35
38
 
36
- Style/ElseAlignment:
39
+ Style/EvalWithLocation:
40
+ Enabled: false
41
+
42
+ Style/ExpandPathArguments:
43
+ Enabled: false
44
+
45
+ Style/GuardClause:
46
+ Enabled: false
47
+
48
+ Style/IfUnlessModifier:
49
+ Enabled: false
50
+
51
+ Style/NumericPredicate:
37
52
  Enabled: false
38
53
 
39
- Style/SpaceInsideParens:
54
+ Style/PercentLiteralDelimiters:
55
+ Enabled: false
56
+
57
+ Style/RedundantBegin:
40
58
  Enabled: false
41
59
 
42
60
  Style/SpecialGlobalVars:
@@ -45,5 +63,56 @@ Style/SpecialGlobalVars:
45
63
  Style/StringLiterals:
46
64
  Enabled: false
47
65
 
48
- Style/TrailingCommaInLiteral:
66
+ Style/SymbolArray:
67
+ Enabled: false
68
+
69
+ Style/TrailingCommaInArrayLiteral:
70
+ Enabled: false
71
+
72
+ Layout/ArgumentAlignment:
73
+ Enabled: false
74
+
75
+ Layout/ParameterAlignment:
76
+ EnforcedStyle: with_fixed_indentation
77
+
78
+ Layout/EndAlignment:
79
+ EnforcedStyleAlignWith: variable
80
+
81
+ Layout/ElseAlignment:
82
+ Enabled: false
83
+
84
+ Layout/EmptyLineAfterGuardClause:
85
+ Enabled: false
86
+
87
+ Layout/HeredocIndentation:
88
+ Enabled: false
89
+
90
+ Layout/SpaceInsideParens:
91
+ Enabled: false
92
+
93
+ Layout/SpaceInsidePercentLiteralDelimiters:
94
+ Enabled: false
95
+
96
+ Lint/ErbNewArguments:
97
+ Enabled: false
98
+
99
+ Lint/MissingCopEnableDirective:
100
+ Enabled: false
101
+
102
+ Lint/PercentStringArray:
103
+ Enabled: false
104
+
105
+ Naming/HeredocDelimiterNaming:
106
+ Enabled: false
107
+
108
+ Naming/MethodParameterName:
109
+ Enabled: false
110
+
111
+ Security/YAMLLoad:
112
+ Enabled: false
113
+
114
+ Gemspec/RequiredRubyVersion:
115
+ Enabled: false
116
+
117
+ Bundler/OrderedGems:
49
118
  Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,36 +1,30 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-03-17 18:14:55 -0700 using RuboCop version 0.38.0.
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: 4
22
- # Cop supports --auto-correct.
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
- # Cop supports --auto-correct.
31
- # Configuration parameters: Keywords.
32
- # Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW
33
- Style/CommentAnnotation:
24
+ Style/CombinableLoops:
34
25
  Exclude:
35
- - 'benchmarks/lib/cli_parser.rb'
36
- - 'lib/activerecord-import/import.rb'
26
+ - 'test/support/shared_examples/recursive_import.rb'
27
+
28
+ Naming/FileName:
29
+ Exclude:
30
+ - 'lib/activerecord-import.rb'
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,143 @@
1
+ ## Changes in 2.0.0
2
+
3
+ ### Breaking Changes
4
+
5
+ * Fix `recursive_on_duplicate_key_update` doesn't work with non-standard
6
+ association name. Thanks to @jacob-carlborg-apoex via \#852. The documentation for the
7
+ `:recursive_on_duplicate_key_update` option specifies that the hash key is
8
+ the association name. But previously the name of associated table was used to
9
+ look up the options. Now the behavior matches the documentation and the name
10
+ of the association is used instead. This only affects associations that uses
11
+ a name that doesn't follow the ActiveRecord naming conventions of
12
+ associations and class names, i.e. when the `class_name:` option is used on
13
+ an association.
14
+
15
+ ## Changes in 1.8.1
16
+
17
+ ### Fixes
18
+
19
+ * Further update for ActiveRecord 7.2 compatibility when running validations. Thanks to @denisahearn via \##847.
20
+
21
+ ## Changes in 1.8.0
22
+
23
+ ### New Features
24
+
25
+ * Add support for ActiveRecord 7.2 via \##845.
26
+
27
+ ## Changes in 1.7.0
28
+
29
+ ### New Features
30
+
31
+ * Add support for ActiveRecord 7.1 composite primary keys. Thanks to @fragkakis via \##837.
32
+ * Add support for upserting associations when doing recursive imports. Thanks to @ramblex via \##778.
33
+
34
+ ## Changes in 1.6.0
35
+
36
+ ### New Features
37
+
38
+ * Add trilogy adapter support. Thanks to @zmariscal via \##825.
39
+
40
+ ### Fixes
41
+
42
+ * Use the locking_enabled? method provided by activerecord to decide whether the lock field should be updated. Thanks to @dombesz via \##822.
43
+
44
+ ## Changes in 1.5.1
45
+
46
+ ### Fixes
47
+
48
+ * Stop memoizing schema_columns_hash so dynamic schema changes are picked up. Thanks to @koshigoe via \##812.
49
+
50
+ ## Changes in 1.5.0
51
+
52
+ ### New Features
53
+
54
+ * Add Rails 7.1 support. Thanks to @gucki via \##807.
55
+ * Add support for alias attributes. Thanks to @leonidkroka via \##799.
56
+
57
+ ### Fixes
58
+
59
+ * Support for multi-byte column names when splitting queries. Thanks to @TakuyaKurimoto via \##801.
60
+ * Fix issue with track_validation_failures when import models. Thanks to @OtaYohihiro via \##798.
61
+
62
+ ## Changes in 1.4.1
63
+
64
+ ### Fixes
65
+
66
+ * Fix importing models that have required belongs_to associations and use composite primary keys. Thanks to @thoughtbot-summer via \##783.
67
+
68
+ ## Changes in 1.4.0
69
+
70
+ ### New Features
71
+
72
+ * Enable compatibility with frozen string literals. Thanks to @desheikh via \##760.
73
+
74
+ ## Changes in 1.3.0
75
+
76
+ ### Fixes
77
+
78
+ * Ensure correct timestamp values are returned for models after insert. Thanks to @kos1kov via \##756.
79
+ * Restore database_version method to public scope. Thanks to @beauraF via \##753.
80
+
81
+ ### New Features
82
+
83
+ * Add support for ActiveRecord 7.0. Thanks to @nickhammond, @ryanwood, @jkowens via \##749 and \##752.
84
+ * Add support for compound foreign keys. Thanks to @Uladzimiro via \##750.
85
+ * Add support for :recursive combined with on_duplicate_key_update: :all. Thanks to @deathwish via \##746.
86
+
87
+ ## Changes in 1.2.0
88
+
89
+ ### Fixes
90
+
91
+ * Update JDBC MySQL adapter to use mysql2 connection adapter. Thanks to @terencechow via \##744.
92
+ * Fix importing STI models with ActiveRecord 6. Thanks to @clemens1483 via \##743.
93
+ * Use polymorphic_name instead of base_class.name for imports. Thanks to @kmhajjar via \##741.
94
+ * Fix compatibility issue with composite primary keys. Thanks to @dlanileonardo via \##737.
95
+ * Prevent double validation of associations on recursive import.
96
+
97
+ ## Changes in 1.1.0
98
+
99
+ ### New Features
100
+
101
+ * Add batch progress reporting. Thanks to @gee-forr via \##729.
102
+
103
+ ## Changes in 1.0.8
104
+
105
+ ### Fixes
106
+
107
+ * Use correct method for clearing query cache. Thanks to @EtienneDepaulis via \##719.
108
+
109
+ ## Changes in 1.0.7
110
+
111
+ ### New Features
112
+
113
+ * Use @@max_allowed_packet session variable instead of querying SHOW VARIABLES. Thanks to @diclophis via \#706.
114
+ * 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.
115
+
116
+ ### Fixes
117
+
118
+ * Prevent mass-assignment errors in Rails strict mode. Thanks to @diclophis via \##709.
119
+
120
+ ## Changes in 1.0.6
121
+
122
+ ### Fixes
123
+
124
+ * Handle after_initialize callbacks. Thanks to @AhMohsen46 via \#691 and
125
+ \#692.
126
+ * Fix regression introduced in 1.0.4. Explicitly allow adapters to
127
+ support on duplicate key update. Thanks to @dsobiera, @jkowens via \#696.
128
+
129
+ ## Changes in 1.0.5
130
+
131
+ ### Fixes
132
+
133
+ * Allow serialized attributes to be returned from import. Thanks to @timanovsky, @jkowens via \#660.
134
+ * Return ActiveRecord::Connection from
135
+ ActiveRecord::Base#establish_connection. Thanks to @reverentF via
136
+ \#663.
137
+ * Support PostgreSQL array. Thanks to @ujihisa via \#669.
138
+ * Skip loading association ids when column changed. Thanks to @Aristat
139
+ via \#673.
140
+
1
141
  ## Changes in 1.0.4
2
142
 
3
143
  ### Fixes
@@ -47,7 +187,7 @@
47
187
  * Fix import issue for models with Postgresql json/jsonb fields. Thanks
48
188
  to @stokarenko via \#594.
49
189
  * Fix issue importing models with timestamps that contain timezone
50
- information. Thaks to @dekaikiwi, @jkowens via \#598.
190
+ information. Thanks to @dekaikiwi, @jkowens via \#598.
51
191
  * Ignore :no_returning when using :recursive option. Thanks to @dgollahon, @jkowens
52
192
  via \#599.
53
193
 
@@ -262,7 +402,7 @@
262
402
  Thanks to @jkowens via \#301.
263
403
  * Allow for custom timestamp columns. Thanks to @mojidabckuu, @jkowens
264
404
  via \#401.
265
-
405
+
266
406
  ### Fixes
267
407
 
268
408
  * Fix ActiveRecord 5 issue coercing boolean values when serializing
@@ -274,7 +414,7 @@
274
414
 
275
415
  * Fix issue where PostgreSQL cannot recognize columns if names
276
416
  include mixed case characters. Thanks to @hugobgranja via \#379.
277
- * Fix an issue for ActiveRecord 5 where serialized fields with
417
+ * Fix an issue for ActiveRecord 5 where serialized fields with
278
418
  default values were not being typecast. Thanks to @whistlerbrk,
279
419
  @jkowens via \#386.
280
420
  * Add option :force_single_insert for MySQL to make sure a single
data/Dockerfile ADDED
@@ -0,0 +1,23 @@
1
+ # Use the official Ruby 3.2 image as a base image
2
+ ARG RUBY_VERSION=3.2
3
+ FROM ruby:${RUBY_VERSION}-bullseye
4
+
5
+ # Set the working directory
6
+ WORKDIR /usr/src/app
7
+
8
+ # Install system packages
9
+ RUN apt-get update -qq && \
10
+ apt-get install -y default-mysql-client postgresql postgresql-contrib vim && \
11
+ apt-get clean
12
+
13
+ # Set environment variables
14
+ ENV AR_VERSION=7.0
15
+
16
+ # Copy all files
17
+ COPY . .
18
+
19
+ # Move sample database.yml and install gems
20
+ RUN mv test/database.yml.sample test/database.yml && \
21
+ bundle install
22
+
23
+ CMD ["irb"]
data/Gemfile CHANGED
@@ -1,59 +1,63 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  version = ENV['AR_VERSION'].to_f
6
8
 
7
- mysql2_version = '0.3.0'
8
- mysql2_version = '0.4.0' if version >= 4.2
9
+ mysql2_version = '0.4.0'
10
+ mysql2_version = '0.5.0' if version >= 6.1
11
+ mysql2_version = '0.5.6' if version >= 8.0
9
12
  sqlite3_version = '1.3.0'
10
13
  sqlite3_version = '1.4.0' if version >= 6.0
14
+ sqlite3_version = '2.2.0' if version >= 8.0
15
+ pg_version = '0.9'
16
+ pg_version = '1.1' if version >= 6.1
17
+ pg_version = '1.5' if version >= 8.0
11
18
 
12
19
  group :development, :test do
13
- gem 'rubocop', '~> 0.40.0'
20
+ gem 'rubocop'
14
21
  gem 'rake'
15
22
  end
16
23
 
17
24
  # Database Adapters
18
25
  platforms :ruby do
19
26
  gem "mysql2", "~> #{mysql2_version}"
20
- gem "pg", "~> 0.9"
27
+ gem "pg", "~> #{pg_version}"
21
28
  gem "sqlite3", "~> #{sqlite3_version}"
22
- gem "seamless_database_pool", "~> 1.0.20"
29
+ # seamless_database_pool requires Ruby ~> 2.0
30
+ gem "seamless_database_pool", "~> 1.0.20" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
31
+ gem "trilogy" if version >= 6.0
32
+ if version >= 6.0 && version <= 7.0
33
+ gem "activerecord-trilogy-adapter"
34
+ end
23
35
  end
24
36
 
25
37
  platforms :jruby do
26
38
  gem "jdbc-mysql"
27
39
  gem "jdbc-postgres"
28
- gem "activerecord-jdbcsqlite3-adapter", "~> 1.3"
29
- gem "activerecord-jdbcmysql-adapter", "~> 1.3"
30
- gem "activerecord-jdbcpostgresql-adapter", "~> 1.3"
40
+ gem "activerecord-jdbcsqlite3-adapter"
41
+ gem "activerecord-jdbcmysql-adapter"
42
+ gem "activerecord-jdbcpostgresql-adapter"
31
43
  end
32
44
 
33
45
  # Support libs
34
- gem "factory_bot"
46
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
47
+ gem "factory_bot"
48
+ else
49
+ gem "factory_bot", "~> 5", "< 6.4.5"
50
+ end
35
51
  gem "timecop"
36
52
  gem "chronic"
37
- gem "mocha", "~> 1.3.0"
53
+ gem "mocha", "~> 2.1.0"
38
54
 
39
55
  # Debugging
40
- platforms :jruby do
41
- gem "ruby-debug", "= 0.10.4"
42
- end
43
-
44
- platforms :mri_19 do
45
- gem "debugger"
46
- end
47
-
48
56
  platforms :ruby do
49
57
  gem "pry-byebug"
50
- gem "rb-readline"
58
+ gem "pry", "~> 0.14.0"
51
59
  end
52
60
 
53
- if version >= 4.0
54
- gem "minitest"
55
- else
56
- gem "test-unit"
57
- end
61
+ gem "minitest"
58
62
 
59
63
  eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)