activerecord-import 2.2.0 → 3.0.0

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +124 -0
  3. data/README.markdown +99 -32
  4. data/lib/activerecord-import/active_record/adapters/mysql2_proxy_adapter.rb +8 -0
  5. data/lib/activerecord-import/active_record/adapters/postgresql_proxy_adapter.rb +8 -0
  6. data/lib/activerecord-import/active_record/adapters/sqlite3_proxy_adapter.rb +8 -0
  7. data/lib/activerecord-import/active_record/adapters/trilogy_proxy_adapter.rb +8 -0
  8. data/lib/activerecord-import/adapters/abstract_adapter.rb +58 -0
  9. data/lib/activerecord-import/adapters/active_record_proxy_adapter.rb +19 -0
  10. data/lib/activerecord-import/adapters/mysql2_proxy_adapter.rb +9 -0
  11. data/lib/activerecord-import/adapters/mysql_adapter.rb +70 -13
  12. data/lib/activerecord-import/adapters/postgresql_adapter.rb +10 -52
  13. data/lib/activerecord-import/adapters/postgresql_proxy_adapter.rb +9 -0
  14. data/lib/activerecord-import/adapters/sqlite3_adapter.rb +7 -3
  15. data/lib/activerecord-import/adapters/sqlite3_proxy_adapter.rb +9 -0
  16. data/lib/activerecord-import/adapters/trilogy_proxy_adapter.rb +9 -0
  17. data/lib/activerecord-import/aliases.rb +42 -0
  18. data/lib/activerecord-import/base.rb +2 -46
  19. data/lib/activerecord-import/core.rb +62 -0
  20. data/lib/activerecord-import/import.rb +612 -369
  21. data/lib/activerecord-import/synchronize.rb +28 -16
  22. data/lib/activerecord-import/version.rb +1 -1
  23. data/lib/activerecord-import/without_aliases.rb +17 -0
  24. metadata +19 -211
  25. data/.github/workflows/test.yaml +0 -165
  26. data/.gitignore +0 -37
  27. data/.rubocop.yml +0 -118
  28. data/.rubocop_todo.yml +0 -30
  29. data/Brewfile +0 -5
  30. data/Dockerfile +0 -23
  31. data/Gemfile +0 -63
  32. data/Rakefile +0 -75
  33. data/activerecord-import.gemspec +0 -28
  34. data/benchmarks/README +0 -32
  35. data/benchmarks/benchmark.rb +0 -72
  36. data/benchmarks/lib/base.rb +0 -143
  37. data/benchmarks/lib/cli_parser.rb +0 -111
  38. data/benchmarks/lib/float.rb +0 -17
  39. data/benchmarks/lib/mysql2_benchmark.rb +0 -21
  40. data/benchmarks/lib/output_to_csv.rb +0 -21
  41. data/benchmarks/lib/output_to_html.rb +0 -66
  42. data/benchmarks/models/test_innodb.rb +0 -5
  43. data/benchmarks/models/test_memory.rb +0 -5
  44. data/benchmarks/models/test_myisam.rb +0 -5
  45. data/benchmarks/schema/mysql2_schema.rb +0 -18
  46. data/docker-compose.yml +0 -34
  47. data/gemfiles/5.2.gemfile +0 -4
  48. data/gemfiles/6.0.gemfile +0 -4
  49. data/gemfiles/6.1.gemfile +0 -4
  50. data/gemfiles/7.0.gemfile +0 -4
  51. data/gemfiles/7.1.gemfile +0 -3
  52. data/gemfiles/7.2.gemfile +0 -3
  53. data/gemfiles/8.0.gemfile +0 -3
  54. data/test/adapters/janus_mysql2.rb +0 -3
  55. data/test/adapters/janus_trilogy.rb +0 -11
  56. data/test/adapters/jdbcmysql.rb +0 -3
  57. data/test/adapters/jdbcpostgresql.rb +0 -3
  58. data/test/adapters/jdbcsqlite3.rb +0 -3
  59. data/test/adapters/makara_postgis.rb +0 -3
  60. data/test/adapters/mysql2.rb +0 -3
  61. data/test/adapters/mysql2_makara.rb +0 -3
  62. data/test/adapters/mysql2_proxy.rb +0 -3
  63. data/test/adapters/mysql2spatial.rb +0 -3
  64. data/test/adapters/postgis.rb +0 -3
  65. data/test/adapters/postgresql.rb +0 -3
  66. data/test/adapters/postgresql_makara.rb +0 -3
  67. data/test/adapters/postgresql_proxy.rb +0 -3
  68. data/test/adapters/seamless_database_pool.rb +0 -3
  69. data/test/adapters/spatialite.rb +0 -3
  70. data/test/adapters/sqlite3.rb +0 -3
  71. data/test/adapters/trilogy.rb +0 -11
  72. data/test/database.yml.sample +0 -73
  73. data/test/github/database.yml +0 -85
  74. data/test/import_test.rb +0 -970
  75. data/test/janus_mysql2/import_test.rb +0 -8
  76. data/test/janus_trilogy/import_test.rb +0 -7
  77. data/test/jdbcmysql/import_test.rb +0 -7
  78. data/test/jdbcpostgresql/import_test.rb +0 -6
  79. data/test/jdbcsqlite3/import_test.rb +0 -6
  80. data/test/makara_postgis/import_test.rb +0 -10
  81. data/test/models/account.rb +0 -5
  82. data/test/models/alarm.rb +0 -4
  83. data/test/models/animal.rb +0 -8
  84. data/test/models/author.rb +0 -9
  85. data/test/models/bike_maker.rb +0 -10
  86. data/test/models/book.rb +0 -18
  87. data/test/models/car.rb +0 -5
  88. data/test/models/card.rb +0 -5
  89. data/test/models/chapter.rb +0 -6
  90. data/test/models/composite_book.rb +0 -19
  91. data/test/models/composite_chapter.rb +0 -12
  92. data/test/models/customer.rb +0 -18
  93. data/test/models/deck.rb +0 -8
  94. data/test/models/dictionary.rb +0 -6
  95. data/test/models/discount.rb +0 -5
  96. data/test/models/end_note.rb +0 -6
  97. data/test/models/group.rb +0 -5
  98. data/test/models/order.rb +0 -17
  99. data/test/models/playing_card.rb +0 -4
  100. data/test/models/promotion.rb +0 -5
  101. data/test/models/question.rb +0 -5
  102. data/test/models/rule.rb +0 -5
  103. data/test/models/tag.rb +0 -12
  104. data/test/models/tag_alias.rb +0 -11
  105. data/test/models/topic.rb +0 -31
  106. data/test/models/user.rb +0 -5
  107. data/test/models/user_token.rb +0 -6
  108. data/test/models/vendor.rb +0 -9
  109. data/test/models/widget.rb +0 -33
  110. data/test/mysql2/import_test.rb +0 -7
  111. data/test/mysql2_makara/import_test.rb +0 -8
  112. data/test/mysql2_proxy/import_test.rb +0 -6
  113. data/test/mysqlspatial2/import_test.rb +0 -8
  114. data/test/postgis/import_test.rb +0 -10
  115. data/test/postgresql/import_test.rb +0 -6
  116. data/test/postgresql_proxy/import_test.rb +0 -6
  117. data/test/schema/generic_schema.rb +0 -230
  118. data/test/schema/jdbcpostgresql_schema.rb +0 -3
  119. data/test/schema/mysql2_schema.rb +0 -21
  120. data/test/schema/postgis_schema.rb +0 -3
  121. data/test/schema/postgresql_schema.rb +0 -94
  122. data/test/schema/sqlite3_schema.rb +0 -15
  123. data/test/schema/version.rb +0 -12
  124. data/test/sqlite3/import_test.rb +0 -6
  125. data/test/support/active_support/test_case_extensions.rb +0 -73
  126. data/test/support/assertions.rb +0 -75
  127. data/test/support/factories.rb +0 -66
  128. data/test/support/generate.rb +0 -31
  129. data/test/support/mysql/import_examples.rb +0 -97
  130. data/test/support/postgresql/import_examples.rb +0 -642
  131. data/test/support/shared_examples/on_duplicate_key_ignore.rb +0 -45
  132. data/test/support/shared_examples/on_duplicate_key_update.rb +0 -437
  133. data/test/support/shared_examples/recursive_import.rb +0 -352
  134. data/test/support/sqlite3/import_examples.rb +0 -232
  135. data/test/synchronize_test.rb +0 -43
  136. data/test/test_helper.rb +0 -91
  137. data/test/trilogy/import_test.rb +0 -7
  138. data/test/value_sets_bytes_parser_test.rb +0 -106
  139. data/test/value_sets_records_parser_test.rb +0 -34
@@ -25,40 +25,52 @@ module ActiveRecord # :nodoc:
25
25
  def self.synchronize(instances, keys = [primary_key])
26
26
  return if instances.empty?
27
27
 
28
+ synchronize_instances(instances, keys) do |instance, fresh_attributes|
29
+ instance.instance_variable_set :@attributes, fresh_attributes
30
+ instance.clear_changes_information
31
+ end
32
+ instances
33
+ end
34
+
35
+ # Finds the records matching the passed in +instances+ on +keys+ and
36
+ # yields each instance that has one together with the attributes of
37
+ # its record, for the block to update the instance with. Returns the
38
+ # instances that had a matching record.
39
+ def self.synchronize_instances(instances, keys) # :nodoc:
40
+ return [] if instances.empty?
41
+
28
42
  conditions = {}
29
43
 
30
- key_values = keys.map { |key| instances.map(&key.to_sym) }
44
+ key_values = keys.map { |key| instances.map(&key.to_sym).uniq }
31
45
  keys.zip(key_values).each { |key, values| conditions[key] = values }
32
46
  order = keys.map { |key| "#{key} ASC" }.join(",")
33
47
 
34
48
  klass = instances.first.class
35
49
 
36
50
  fresh_instances = klass.unscoped.where(conditions).order(order)
37
- instances.each do |instance|
38
- matched_instance = fresh_instances.detect do |fresh_instance|
39
- keys.all? { |key| fresh_instance.send(key) == instance.send(key) }
40
- end
51
+ fresh_instances_by_key = fresh_instances.each_with_object({}) do |fresh_instance, records_by_key|
52
+ key = keys.map { |key_column| fresh_instance.send(key_column) }
53
+ records_by_key[key] ||= fresh_instance
54
+ end
41
55
 
42
- next unless matched_instance
56
+ instances.select do |instance|
57
+ key = keys.map { |key_column| instance.send(key_column) }
58
+ matched_instance = fresh_instances_by_key[key]
43
59
 
44
- instance.instance_variable_set :@association_cache, {}
45
- instance.send :clear_aggregation_cache if instance.respond_to?(:clear_aggregation_cache, true)
46
- instance.instance_variable_set :@attributes, matched_instance.instance_variable_get(:@attributes)
60
+ next false unless matched_instance
47
61
 
48
- if instance.respond_to?(:clear_changes_information)
49
- instance.clear_changes_information # Rails 4.2 and higher
50
- else
51
- instance.instance_variable_set :@attributes_cache, {} # Rails 4.0, 4.1
52
- instance.changed_attributes.clear # Rails 3.2
53
- instance.previous_changes.clear
54
- end
62
+ instance.instance_variable_set :@association_cache, {}
63
+ instance.send :clear_aggregation_cache
64
+ yield instance, matched_instance.instance_variable_get(:@attributes)
55
65
 
56
66
  # Since the instance now accurately reflects the record in
57
67
  # the database, ensure that instance.persisted? is true.
58
68
  instance.instance_variable_set '@new_record', false
59
69
  instance.instance_variable_set '@destroyed', false
70
+ true
60
71
  end
61
72
  end
73
+ private_class_method :synchronize_instances
62
74
 
63
75
  # See ActiveRecord::ConnectionAdapters::AbstractAdapter.synchronize
64
76
  def synchronize(instances, key = [ActiveRecord::Base.primary_key])
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Import
5
- VERSION = "2.2.0"
5
+ VERSION = "3.0.0"
6
6
  end
7
7
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Loads activerecord-import without aliasing +import+ and +import!+ to
4
+ # +bulk_import+ and +bulk_import!+, for compatibility with gems that define
5
+ # their own +import+ method on models, such as elasticsearch-model:
6
+ #
7
+ # gem "activerecord-import", require: "activerecord-import/without_aliases"
8
+ #
9
+ # This takes precedence over "activerecord-import" and "activerecord-import/base",
10
+ # regardless of the order they are required in.
11
+
12
+ require "active_support/lazy_load_hooks"
13
+
14
+ ActiveSupport.on_load(:active_record) do
15
+ require "activerecord-import/core"
16
+ ActiveRecord::Import.skip_aliases!
17
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-05-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '4.2'
18
+ version: '6.1'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '4.2'
25
+ version: '6.1'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -45,152 +44,48 @@ executables: []
45
44
  extensions: []
46
45
  extra_rdoc_files: []
47
46
  files:
48
- - ".github/workflows/test.yaml"
49
- - ".gitignore"
50
- - ".rubocop.yml"
51
- - ".rubocop_todo.yml"
52
- - Brewfile
53
47
  - CHANGELOG.md
54
- - Dockerfile
55
- - Gemfile
56
48
  - LICENSE
57
49
  - README.markdown
58
- - Rakefile
59
- - activerecord-import.gemspec
60
- - benchmarks/README
61
- - benchmarks/benchmark.rb
62
- - benchmarks/lib/base.rb
63
- - benchmarks/lib/cli_parser.rb
64
- - benchmarks/lib/float.rb
65
- - benchmarks/lib/mysql2_benchmark.rb
66
- - benchmarks/lib/output_to_csv.rb
67
- - benchmarks/lib/output_to_html.rb
68
- - benchmarks/models/test_innodb.rb
69
- - benchmarks/models/test_memory.rb
70
- - benchmarks/models/test_myisam.rb
71
- - benchmarks/schema/mysql2_schema.rb
72
- - docker-compose.yml
73
- - gemfiles/5.2.gemfile
74
- - gemfiles/6.0.gemfile
75
- - gemfiles/6.1.gemfile
76
- - gemfiles/7.0.gemfile
77
- - gemfiles/7.1.gemfile
78
- - gemfiles/7.2.gemfile
79
- - gemfiles/8.0.gemfile
80
50
  - lib/activerecord-import.rb
81
51
  - lib/activerecord-import/active_record/adapters/abstract_adapter.rb
82
52
  - lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb
83
53
  - lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb
84
54
  - lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb
85
55
  - lib/activerecord-import/active_record/adapters/mysql2_adapter.rb
56
+ - lib/activerecord-import/active_record/adapters/mysql2_proxy_adapter.rb
86
57
  - lib/activerecord-import/active_record/adapters/postgresql_adapter.rb
58
+ - lib/activerecord-import/active_record/adapters/postgresql_proxy_adapter.rb
87
59
  - lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb
88
60
  - lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb
61
+ - lib/activerecord-import/active_record/adapters/sqlite3_proxy_adapter.rb
89
62
  - lib/activerecord-import/active_record/adapters/trilogy_adapter.rb
63
+ - lib/activerecord-import/active_record/adapters/trilogy_proxy_adapter.rb
90
64
  - lib/activerecord-import/adapters/abstract_adapter.rb
65
+ - lib/activerecord-import/adapters/active_record_proxy_adapter.rb
91
66
  - lib/activerecord-import/adapters/em_mysql2_adapter.rb
92
67
  - lib/activerecord-import/adapters/mysql2_adapter.rb
68
+ - lib/activerecord-import/adapters/mysql2_proxy_adapter.rb
93
69
  - lib/activerecord-import/adapters/mysql_adapter.rb
94
70
  - lib/activerecord-import/adapters/postgresql_adapter.rb
71
+ - lib/activerecord-import/adapters/postgresql_proxy_adapter.rb
95
72
  - lib/activerecord-import/adapters/sqlite3_adapter.rb
73
+ - lib/activerecord-import/adapters/sqlite3_proxy_adapter.rb
96
74
  - lib/activerecord-import/adapters/trilogy_adapter.rb
75
+ - lib/activerecord-import/adapters/trilogy_proxy_adapter.rb
76
+ - lib/activerecord-import/aliases.rb
97
77
  - lib/activerecord-import/base.rb
78
+ - lib/activerecord-import/core.rb
98
79
  - lib/activerecord-import/import.rb
99
80
  - lib/activerecord-import/synchronize.rb
100
81
  - lib/activerecord-import/value_sets_parser.rb
101
82
  - lib/activerecord-import/version.rb
102
- - test/adapters/janus_mysql2.rb
103
- - test/adapters/janus_trilogy.rb
104
- - test/adapters/jdbcmysql.rb
105
- - test/adapters/jdbcpostgresql.rb
106
- - test/adapters/jdbcsqlite3.rb
107
- - test/adapters/makara_postgis.rb
108
- - test/adapters/mysql2.rb
109
- - test/adapters/mysql2_makara.rb
110
- - test/adapters/mysql2_proxy.rb
111
- - test/adapters/mysql2spatial.rb
112
- - test/adapters/postgis.rb
113
- - test/adapters/postgresql.rb
114
- - test/adapters/postgresql_makara.rb
115
- - test/adapters/postgresql_proxy.rb
116
- - test/adapters/seamless_database_pool.rb
117
- - test/adapters/spatialite.rb
118
- - test/adapters/sqlite3.rb
119
- - test/adapters/trilogy.rb
120
- - test/database.yml.sample
121
- - test/github/database.yml
122
- - test/import_test.rb
123
- - test/janus_mysql2/import_test.rb
124
- - test/janus_trilogy/import_test.rb
125
- - test/jdbcmysql/import_test.rb
126
- - test/jdbcpostgresql/import_test.rb
127
- - test/jdbcsqlite3/import_test.rb
128
- - test/makara_postgis/import_test.rb
129
- - test/models/account.rb
130
- - test/models/alarm.rb
131
- - test/models/animal.rb
132
- - test/models/author.rb
133
- - test/models/bike_maker.rb
134
- - test/models/book.rb
135
- - test/models/car.rb
136
- - test/models/card.rb
137
- - test/models/chapter.rb
138
- - test/models/composite_book.rb
139
- - test/models/composite_chapter.rb
140
- - test/models/customer.rb
141
- - test/models/deck.rb
142
- - test/models/dictionary.rb
143
- - test/models/discount.rb
144
- - test/models/end_note.rb
145
- - test/models/group.rb
146
- - test/models/order.rb
147
- - test/models/playing_card.rb
148
- - test/models/promotion.rb
149
- - test/models/question.rb
150
- - test/models/rule.rb
151
- - test/models/tag.rb
152
- - test/models/tag_alias.rb
153
- - test/models/topic.rb
154
- - test/models/user.rb
155
- - test/models/user_token.rb
156
- - test/models/vendor.rb
157
- - test/models/widget.rb
158
- - test/mysql2/import_test.rb
159
- - test/mysql2_makara/import_test.rb
160
- - test/mysql2_proxy/import_test.rb
161
- - test/mysqlspatial2/import_test.rb
162
- - test/postgis/import_test.rb
163
- - test/postgresql/import_test.rb
164
- - test/postgresql_proxy/import_test.rb
165
- - test/schema/generic_schema.rb
166
- - test/schema/jdbcpostgresql_schema.rb
167
- - test/schema/mysql2_schema.rb
168
- - test/schema/postgis_schema.rb
169
- - test/schema/postgresql_schema.rb
170
- - test/schema/sqlite3_schema.rb
171
- - test/schema/version.rb
172
- - test/sqlite3/import_test.rb
173
- - test/support/active_support/test_case_extensions.rb
174
- - test/support/assertions.rb
175
- - test/support/factories.rb
176
- - test/support/generate.rb
177
- - test/support/mysql/import_examples.rb
178
- - test/support/postgresql/import_examples.rb
179
- - test/support/shared_examples/on_duplicate_key_ignore.rb
180
- - test/support/shared_examples/on_duplicate_key_update.rb
181
- - test/support/shared_examples/recursive_import.rb
182
- - test/support/sqlite3/import_examples.rb
183
- - test/synchronize_test.rb
184
- - test/test_helper.rb
185
- - test/trilogy/import_test.rb
186
- - test/value_sets_bytes_parser_test.rb
187
- - test/value_sets_records_parser_test.rb
83
+ - lib/activerecord-import/without_aliases.rb
188
84
  homepage: https://github.com/zdennis/activerecord-import
189
85
  licenses:
190
86
  - MIT
191
87
  metadata:
192
88
  changelog_uri: https://github.com/zdennis/activerecord-import/blob/master/CHANGELOG.md
193
- post_install_message:
194
89
  rdoc_options: []
195
90
  require_paths:
196
91
  - lib
@@ -198,101 +93,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
93
  requirements:
199
94
  - - ">="
200
95
  - !ruby/object:Gem::Version
201
- version: 2.4.0
96
+ version: 3.1.0
202
97
  required_rubygems_version: !ruby/object:Gem::Requirement
203
98
  requirements:
204
99
  - - ">="
205
100
  - !ruby/object:Gem::Version
206
101
  version: '0'
207
102
  requirements: []
208
- rubygems_version: 3.0.3.1
209
- signing_key:
103
+ rubygems_version: 4.0.0
210
104
  specification_version: 4
211
105
  summary: Bulk insert extension for ActiveRecord
212
- test_files:
213
- - test/adapters/janus_mysql2.rb
214
- - test/adapters/janus_trilogy.rb
215
- - test/adapters/jdbcmysql.rb
216
- - test/adapters/jdbcpostgresql.rb
217
- - test/adapters/jdbcsqlite3.rb
218
- - test/adapters/makara_postgis.rb
219
- - test/adapters/mysql2.rb
220
- - test/adapters/mysql2_makara.rb
221
- - test/adapters/mysql2_proxy.rb
222
- - test/adapters/mysql2spatial.rb
223
- - test/adapters/postgis.rb
224
- - test/adapters/postgresql.rb
225
- - test/adapters/postgresql_makara.rb
226
- - test/adapters/postgresql_proxy.rb
227
- - test/adapters/seamless_database_pool.rb
228
- - test/adapters/spatialite.rb
229
- - test/adapters/sqlite3.rb
230
- - test/adapters/trilogy.rb
231
- - test/database.yml.sample
232
- - test/github/database.yml
233
- - test/import_test.rb
234
- - test/janus_mysql2/import_test.rb
235
- - test/janus_trilogy/import_test.rb
236
- - test/jdbcmysql/import_test.rb
237
- - test/jdbcpostgresql/import_test.rb
238
- - test/jdbcsqlite3/import_test.rb
239
- - test/makara_postgis/import_test.rb
240
- - test/models/account.rb
241
- - test/models/alarm.rb
242
- - test/models/animal.rb
243
- - test/models/author.rb
244
- - test/models/bike_maker.rb
245
- - test/models/book.rb
246
- - test/models/car.rb
247
- - test/models/card.rb
248
- - test/models/chapter.rb
249
- - test/models/composite_book.rb
250
- - test/models/composite_chapter.rb
251
- - test/models/customer.rb
252
- - test/models/deck.rb
253
- - test/models/dictionary.rb
254
- - test/models/discount.rb
255
- - test/models/end_note.rb
256
- - test/models/group.rb
257
- - test/models/order.rb
258
- - test/models/playing_card.rb
259
- - test/models/promotion.rb
260
- - test/models/question.rb
261
- - test/models/rule.rb
262
- - test/models/tag.rb
263
- - test/models/tag_alias.rb
264
- - test/models/topic.rb
265
- - test/models/user.rb
266
- - test/models/user_token.rb
267
- - test/models/vendor.rb
268
- - test/models/widget.rb
269
- - test/mysql2/import_test.rb
270
- - test/mysql2_makara/import_test.rb
271
- - test/mysql2_proxy/import_test.rb
272
- - test/mysqlspatial2/import_test.rb
273
- - test/postgis/import_test.rb
274
- - test/postgresql/import_test.rb
275
- - test/postgresql_proxy/import_test.rb
276
- - test/schema/generic_schema.rb
277
- - test/schema/jdbcpostgresql_schema.rb
278
- - test/schema/mysql2_schema.rb
279
- - test/schema/postgis_schema.rb
280
- - test/schema/postgresql_schema.rb
281
- - test/schema/sqlite3_schema.rb
282
- - test/schema/version.rb
283
- - test/sqlite3/import_test.rb
284
- - test/support/active_support/test_case_extensions.rb
285
- - test/support/assertions.rb
286
- - test/support/factories.rb
287
- - test/support/generate.rb
288
- - test/support/mysql/import_examples.rb
289
- - test/support/postgresql/import_examples.rb
290
- - test/support/shared_examples/on_duplicate_key_ignore.rb
291
- - test/support/shared_examples/on_duplicate_key_update.rb
292
- - test/support/shared_examples/recursive_import.rb
293
- - test/support/sqlite3/import_examples.rb
294
- - test/synchronize_test.rb
295
- - test/test_helper.rb
296
- - test/trilogy/import_test.rb
297
- - test/value_sets_bytes_parser_test.rb
298
- - test/value_sets_records_parser_test.rb
106
+ test_files: []
@@ -1,165 +0,0 @@
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
- bundle exec rake test:mysql2_proxy
129
- bundle exec rake test:janus_mysql2
130
- - name: Run tests with postgresql
131
- run: |
132
- bundle exec rake test:postgis
133
- bundle exec rake test:postgresql
134
- bundle exec rake test:postgresql_makara
135
- bundle exec rake test:postgresql_proxy
136
- - name: Run tests with seamless_database_pool
137
- run: |
138
- bundle exec rake test:seamless_database_pool
139
- if: ${{ matrix.ruby < '3.0' }}
140
- - name: Run tests with sqlite
141
- run: |
142
- bundle exec rake test:spatialite
143
- bundle exec rake test:sqlite3
144
- - name: Run trilogy tests
145
- if: ${{ matrix.env.AR_VERSION >= '7.0' && !startsWith(matrix.ruby, 'jruby') }}
146
- run: |
147
- bundle exec rake test:trilogy
148
- bundle exec rake test:janus_trilogy
149
-
150
- lint:
151
- runs-on: ubuntu-latest
152
- env:
153
- AR_VERSION: '7.0'
154
- steps:
155
- - uses: actions/checkout@v4
156
- - name: Install SQLite3 Development Library
157
- run: |
158
- sudo apt-get update
159
- sudo apt-get install libsqlite3-dev
160
- - uses: ruby/setup-ruby@v1
161
- with:
162
- ruby-version: 3.0
163
- bundler-cache: true
164
- - name: Run Rubocop
165
- run: bundle exec rubocop
data/.gitignore DELETED
@@ -1,37 +0,0 @@
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
- ## Idea
17
- .idea
18
-
19
- ## PROJECT::GENERAL
20
- coverage
21
- rdoc
22
- pkg
23
- *.gem
24
- *.lock
25
- .byebug_history
26
-
27
- ## PROJECT::SPECIFIC
28
- log/*.log
29
- test.db
30
- test/database.yml
31
- benchmarks/log/
32
-
33
- .ruby-*
34
- .bundle/
35
- .redcar/
36
- .rvmrc
37
- docsite/