activerecord-import 1.0.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b32b91e70dc3ec25461a37092b774709300798912b930aeb9e7ae57dba41230d
4
- data.tar.gz: 5b64d6bc14cae05785300a72cd830e552cd5b21d0dbb304e4e527f69de9865c5
3
+ metadata.gz: b3360334cbd71089351c8211214bb4aedf0bd3e65305513b17c9fb09e3f1cf19
4
+ data.tar.gz: 2b97e3a1c6c2b39970dd3bb2a00a608d6e105cddac19d3f9ebaf28f8f30ece69
5
5
  SHA512:
6
- metadata.gz: 04a16537b5cd4ef535e7ed1c49397b1313d2717f5b60ed43cdee42f220d3a0094d0b4cce6241470c892a184b09d74b28ece67d28506508964f962c9282aa763c
7
- data.tar.gz: d84f9ffea3a04a2ca3b2bb3dfc05307a90876d5c7e9f8e155605dbc7a6bbcec8cd3cfefc7aac82a7e14de0ae5334cdeba3ac6467c00206ccd15e016aebe8854e
6
+ metadata.gz: 4585ba6ff2300d94fbd646d5f5a07cc254311cb9a47eacc7b1266eab8df5d9a53ca3018232e6c2517f05e1aef0dafaff20942bd1150ef518d688940f795bf2a9
7
+ data.tar.gz: 532506d134f067323d0490a913739089e55bf17893f602c752e5e963af2d7d799f5200a72cc48e7c780992e9f82c68273dc7af308034664ba898ed5292e199c4
@@ -0,0 +1,73 @@
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
+ - 2.6
24
+ env:
25
+ - AR_VERSION: 6.1
26
+ - AR_VERSION: 6.0
27
+ - AR_VERSION: 5.2
28
+ - AR_VERSION: 5.1
29
+ include:
30
+ - ruby: 2.4
31
+ env:
32
+ AR_VERSION: 5.0
33
+ - ruby: 2.4
34
+ env:
35
+ AR_VERSION: 4.2
36
+ runs-on: ubuntu-latest
37
+ env:
38
+ AR_VERSION: ${{ matrix.env.AR_VERSION }}
39
+ DB_DATABASE: activerecord_import_test
40
+ steps:
41
+ - uses: actions/checkout@v2
42
+ - uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ - name: Setup Bundler 1.x for Ruby 2.3
46
+ if: ${{ matrix.ruby == '2.3' }}
47
+ run: echo "BUNDLER_VERSION=1.17.3" >> $GITHUB_ENV
48
+ - name: Set up databases
49
+ run: |
50
+ sudo /etc/init.d/mysql start
51
+ mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }} CHARACTER SET utf8 COLLATE utf8_general_ci;' -u root -proot
52
+ psql -h localhost -U postgres -c 'create database ${{ env.DB_DATABASE }};'
53
+ psql -h localhost -U postgres -d ${{ env.DB_DATABASE }} -c 'create extension if not exists hstore;'
54
+ psql -h localhost -U postgres -c 'create extension if not exists postgis;'
55
+ psql -h localhost -U postgres -c 'create extension if not exists "uuid-ossp";'
56
+ cp test/github/database.yml test/database.yml
57
+ env:
58
+ PGPASSWORD: postgres
59
+ - name: Install dependencies
60
+ run : AR_VERSION=${{ env.AR_VERSION }} bundle install
61
+ - name: Run tests
62
+ run: |
63
+ bundle exec rake test:mysql2
64
+ bundle exec rake test:mysql2_makara
65
+ bundle exec rake test:mysql2spatial
66
+ bundle exec rake test:postgis
67
+ bundle exec rake test:postgresql
68
+ bundle exec rake test:postgresql_makara
69
+ bundle exec rake test:seamless_database_pool
70
+ bundle exec rake test:spatialite
71
+ bundle exec rake test:sqlite3
72
+ - name: Run Rubocop
73
+ run: bundle exec rubocop
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## Changes in 1.2.0
2
+
3
+ ### Fixes
4
+
5
+ * Update JDBC MySQL adapter to use mysql2 connection adapter. Thanks to @terencechow via \##744.
6
+ * Fix importing STI models with ActiveRecord 6. Thanks to @clemens1483 via \##743.
7
+ * Use polymorphic_name instead of base_class.name for imports. Thanks to @kmhajjar via \##741.
8
+ * Fix compatibility issue with composite primary keys. Thanks to @dlanileonardo via \##737.
9
+ * Prevent double validation of associations on recursive import.
10
+
11
+ ## Changes in 1.1.0
12
+
13
+ ### New Features
14
+
15
+ * Add batch progress reporting. Thanks to @gee-forr via \##729.
16
+
1
17
  ## Changes in 1.0.8
2
18
 
3
19
  ### Fixes
@@ -6,6 +22,8 @@
6
22
 
7
23
  ## Changes in 1.0.7
8
24
 
25
+ ### New Features
26
+
9
27
  * Use @@max_allowed_packet session variable instead of querying SHOW VARIABLES. Thanks to @diclophis via \#706.
10
28
  * 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.
11
29
 
@@ -19,7 +37,7 @@
19
37
 
20
38
  * Handle after_initialize callbacks. Thanks to @AhMohsen46 via \#691 and
21
39
  \#692.
22
- * Fix regression introduced in 1.0.4. Explicity allow adapters to
40
+ * Fix regression introduced in 1.0.4. Explicitly allow adapters to
23
41
  support on duplicate key update. Thanks to @dsobiera, @jkowens via \#696.
24
42
 
25
43
  ## Changes in 1.0.5
@@ -28,7 +46,7 @@
28
46
 
29
47
  * Allow serialized attributes to be returned from import. Thanks to @timanovsky, @jkowens via \#660.
30
48
  * Return ActiveRecord::Connection from
31
- ActiveREcord::Base#establish_connection. Thanks to @reverentF via
49
+ ActiveRecord::Base#establish_connection. Thanks to @reverentF via
32
50
  \#663.
33
51
  * Support PostgreSQL array. Thanks to @ujihisa via \#669.
34
52
  * Skip loading association ids when column changed. Thanks to @Aristat
@@ -83,7 +101,7 @@
83
101
  * Fix import issue for models with Postgresql json/jsonb fields. Thanks
84
102
  to @stokarenko via \#594.
85
103
  * Fix issue importing models with timestamps that contain timezone
86
- information. Thaks to @dekaikiwi, @jkowens via \#598.
104
+ information. Thanks to @dekaikiwi, @jkowens via \#598.
87
105
  * Ignore :no_returning when using :recursive option. Thanks to @dgollahon, @jkowens
88
106
  via \#599.
89
107
 
data/Gemfile CHANGED
@@ -26,7 +26,7 @@ platforms :ruby do
26
26
  end
27
27
 
28
28
  platforms :jruby do
29
- gem "jdbc-mysql"
29
+ gem 'jdbc-mysql', '< 8', require: false
30
30
  gem "jdbc-postgres"
31
31
  gem "activerecord-jdbcsqlite3-adapter", "~> 1.3"
32
32
  gem "activerecord-jdbcmysql-adapter", "~> 1.3"
data/README.markdown CHANGED
@@ -1,4 +1,4 @@
1
- # Activerecord-Import [![Build Status](https://travis-ci.org/zdennis/activerecord-import.svg?branch=master)](https://travis-ci.org/zdennis/activerecord-import)
1
+ # Activerecord-Import ![Build Status](https://github.com/zdennis/activerecord-import/actions/workflows/test.yaml/badge.svg)
2
2
 
3
3
  Activerecord-Import is a library for bulk inserting data using ActiveRecord.
4
4
 
@@ -231,6 +231,18 @@ columns = [ :title ]
231
231
  Book.import columns, books, batch_size: 2
232
232
  ```
233
233
 
234
+ If your import is particularly large or slow (possibly due to [callbacks](#callbacks)) whilst batch importing, you might want a way to report back on progress. This is supported by passing a callable as the `batch_progress` option. e.g:
235
+
236
+ ```ruby
237
+ my_proc = ->(rows_size, num_batches, current_batch_number, batch_duration_in_secs) {
238
+ # Using the arguments provided to the callable, you can
239
+ # send an email, post to a websocket,
240
+ # update slack, alert if import is taking too long, etc.
241
+ }
242
+
243
+ Book.import columns, books, batch_size: 2, batch_progress: my_proc
244
+ ```
245
+
234
246
  #### Recursive
235
247
 
236
248
  NOTE: This only works with PostgreSQL and ActiveRecord objects. This won't work with
@@ -254,8 +266,8 @@ Key | Options | Default | Descrip
254
266
  ------------------------- | --------------------- | ------------------ | -----------
255
267
  :validate | `true`/`false` | `true` | Whether or not to run `ActiveRecord` validations (uniqueness skipped). This option will always be true when using `import!`.
256
268
  :validate_uniqueness | `true`/`false` | `false` | Whether or not to run uniqueness validations, has potential pitfalls, use with caution (requires `>= v0.27.0`).
257
- :validate_with_context | `Symbol` |`:create`/`:update` | Allows passing an ActiveModel validation context for each model. Default is `:create` for new records and `:update` for existing ones.
258
- :track_validation_failures| `true`/`false` | `false` | 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]`
269
+ :validate_with_context | `Symbol` |`:create`/`:update` | Allows passing an ActiveModel validation context for each model. Default is `:create` for new records and `:update` for existing ones.
270
+ :track_validation_failures| `true`/`false` | `false` | 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]`
259
271
  :on_duplicate_key_ignore | `true`/`false` | `false` | Allows skipping records with duplicate keys. See [here](https://github.com/zdennis/activerecord-import/#duplicate-key-ignore) for more details.
260
272
  :ignore | `true`/`false` | `false` | Alias for :on_duplicate_key_ignore.
261
273
  :on_duplicate_key_update | :all, `Array`, `Hash` | N/A | Allows upsert logic to be used. See [here](https://github.com/zdennis/activerecord-import/#duplicate-key-update) for more details.
@@ -380,7 +392,7 @@ Book.import books, validate_uniqueness: true
380
392
 
381
393
  ### Return Info
382
394
 
383
- The `import` method returns a `Result` object that responds to `failed_instances` and `num_inserts`. Additionally, for users of Postgres, there will be two arrays `ids` and `results` that can be accessed`.
395
+ The `import` method returns a `Result` object that responds to `failed_instances` and `num_inserts`. Additionally, for users of Postgres, there will be two arrays `ids` and `results` that can be accessed.
384
396
 
385
397
  ```ruby
386
398
  articles = [
@@ -1,6 +1,6 @@
1
- require "active_record/connection_adapters/mysql_adapter"
2
- require "activerecord-import/adapters/mysql_adapter"
1
+ require "active_record/connection_adapters/mysql2_adapter"
2
+ require "activerecord-import/adapters/mysql2_adapter"
3
3
 
4
- class ActiveRecord::ConnectionAdapters::MysqlAdapter
5
- include ActiveRecord::Import::MysqlAdapter
4
+ class ActiveRecord::ConnectionAdapters::Mysql2Adapter
5
+ include ActiveRecord::Import::Mysql2Adapter
6
6
  end
@@ -49,7 +49,7 @@ module ActiveRecord::Import #:nodoc:
49
49
  associations = klass.reflect_on_all_associations(:belongs_to)
50
50
  associations.each do |assoc|
51
51
  if (index = attrs.index(assoc.name))
52
- key = assoc.foreign_key.to_sym
52
+ key = assoc.foreign_key.is_a?(Array) ? assoc.foreign_key.map(&:to_sym) : assoc.foreign_key.to_sym
53
53
  attrs[index] = key unless attrs.include?(key)
54
54
  end
55
55
  end
@@ -734,7 +734,7 @@ class ActiveRecord::Base
734
734
  set_attributes_and_mark_clean(models, return_obj, timestamps, options)
735
735
 
736
736
  # if there are auto-save associations on the models we imported that are new, import them as well
737
- import_associations(models, options.dup) if options[:recursive]
737
+ import_associations(models, options.dup.merge(validate: false)) if options[:recursive]
738
738
  end
739
739
 
740
740
  return_obj
@@ -775,21 +775,22 @@ class ActiveRecord::Base
775
775
  unless scope_columns.blank?
776
776
  scope_columns.zip(scope_values).each do |name, value|
777
777
  name_as_sym = name.to_sym
778
- next if column_names.include?(name_as_sym)
779
-
780
- is_sti = (name_as_sym == inheritance_column.to_sym && self < base_class)
781
- value = Array(value).first if is_sti
782
-
778
+ next if column_names.include?(name_as_sym) || name_as_sym == inheritance_column.to_sym
783
779
  column_names << name_as_sym
784
780
  array_of_attributes.each { |attrs| attrs << value }
785
781
  end
786
782
  end
787
783
 
784
+ if finder_needs_type_condition?
785
+ unless column_names.include?(inheritance_column.to_sym)
786
+ column_names << inheritance_column.to_sym
787
+ array_of_attributes.each { |attrs| attrs << sti_name }
788
+ end
789
+ end
790
+
788
791
  columns = column_names.each_with_index.map do |name, i|
789
792
  column = columns_hash[name.to_s]
790
-
791
793
  raise ActiveRecord::Import::MissingColumnError.new(name.to_s, i) if column.nil?
792
-
793
794
  column
794
795
  end
795
796
 
@@ -805,17 +806,29 @@ class ActiveRecord::Base
805
806
  if supports_import?
806
807
  # generate the sql
807
808
  post_sql_statements = connection.post_sql_statements( quoted_table_name, options )
809
+ import_size = values_sql.size
810
+
811
+ batch_size = options[:batch_size] || import_size
812
+ run_proc = options[:batch_size].to_i.positive? && options[:batch_progress].respond_to?( :call )
813
+ progress_proc = options[:batch_progress]
814
+ current_batch = 0
815
+ batches = (import_size / batch_size.to_f).ceil
808
816
 
809
- batch_size = options[:batch_size] || values_sql.size
810
817
  values_sql.each_slice(batch_size) do |batch_values|
818
+ batch_started_at = Time.now.to_i
819
+
811
820
  # perform the inserts
812
821
  result = connection.insert_many( [insert_sql, post_sql_statements].flatten,
813
822
  batch_values,
814
823
  options,
815
824
  "#{model_name} Create Many" )
825
+
816
826
  number_inserted += result.num_inserts
817
827
  ids += result.ids
818
828
  results += result.results
829
+ current_batch += 1
830
+
831
+ progress_proc.call(import_size, batches, current_batch, Time.now.to_i - batch_started_at) if run_proc
819
832
  end
820
833
  else
821
834
  transaction(requires_new: true) do
@@ -949,8 +962,13 @@ class ActiveRecord::Base
949
962
  changed_objects.each do |child|
950
963
  child.public_send("#{association_reflection.foreign_key}=", model.id)
951
964
  # For polymorphic associations
965
+ association_name = if model.class.respond_to?(:polymorphic_name)
966
+ model.class.polymorphic_name
967
+ else
968
+ model.class.base_class
969
+ end
952
970
  association_reflection.type.try do |type|
953
- child.public_send("#{type}=", model.class.base_class.name)
971
+ child.public_send("#{type}=", association_name)
954
972
  end
955
973
  end
956
974
  associated_objects_by_class[model.class.name][association_reflection.name].concat changed_objects
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Import
3
- VERSION = "1.0.8".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
@@ -1,7 +1,8 @@
1
1
  common: &common
2
2
  username: root
3
- password:
3
+ password: root
4
4
  encoding: utf8
5
+ collation: utf8_general_ci
5
6
  host: localhost
6
7
  database: activerecord_import_test
7
8
 
@@ -37,6 +38,7 @@ oracle:
37
38
  postgresql: &postgresql
38
39
  <<: *common
39
40
  username: postgres
41
+ password: postgres
40
42
  adapter: postgresql
41
43
  min_messages: warning
42
44
 
data/test/import_test.rb CHANGED
@@ -169,7 +169,17 @@ describe "#import" do
169
169
  assert_difference "Dictionary.count", +1 do
170
170
  Dictionary.import dictionaries
171
171
  end
172
- assert_equal "Dictionary", Dictionary.first.type
172
+ assert_equal "Dictionary", Dictionary.last.type
173
+ end
174
+
175
+ it "should import arrays successfully" do
176
+ columns = [:author_name, :title]
177
+ values = [["Noah Webster", "Webster's Dictionary"]]
178
+
179
+ assert_difference "Dictionary.count", +1 do
180
+ Dictionary.import columns, values
181
+ end
182
+ assert_equal "Dictionary", Dictionary.last.type
173
183
  end
174
184
  end
175
185
 
@@ -405,6 +415,15 @@ describe "#import" do
405
415
  assert_equal 3, result.num_inserts if Topic.supports_import?
406
416
  end
407
417
  end
418
+
419
+ it "should accept and call an optional callable to run after each batch" do
420
+ lambda_called = 0
421
+
422
+ my_proc = ->(_row_count, _batches, _batch, _duration) { lambda_called += 1 }
423
+ Topic.import Build(10, :topics), batch_size: 4, batch_progress: my_proc
424
+
425
+ assert_equal 3, lambda_called
426
+ end
408
427
  end
409
428
 
410
429
  context "with :synchronize option" do
@@ -652,6 +671,14 @@ describe "#import" do
652
671
  assert_equal [val1, val2], scope.map(&column).sort
653
672
  end
654
673
 
674
+ context "for cards and decks" do
675
+ it "works when the polymorphic name is different than base class name" do
676
+ deck = Deck.create(id: 1, name: 'test')
677
+ deck.cards.import [:id, :deck_type], [[1, 'PlayingCard']]
678
+ assert_equal deck.cards.first.deck_type, "PlayingCard"
679
+ end
680
+ end
681
+
655
682
  it "works importing array of hashes" do
656
683
  scope.import [{ column => val1 }, { column => val2 }]
657
684
 
@@ -0,0 +1,3 @@
1
+ class Card < ActiveRecord::Base
2
+ belongs_to :deck, polymorphic: true
3
+ end
@@ -0,0 +1,6 @@
1
+ class Deck < ActiveRecord::Base
2
+ has_many :cards
3
+ def self.polymorphic_name
4
+ "PlayingCard"
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ class PlayingCard < ActiveRecord::Base
2
+ end
@@ -52,6 +52,20 @@ ActiveRecord::Schema.define do
52
52
  t.string :name
53
53
  end
54
54
 
55
+ create_table :cards, force: :cascade do |t|
56
+ t.string :name
57
+ t.string :deck_type
58
+ t.integer :deck_id
59
+ end
60
+
61
+ create_table :decks, force: :cascade do |t|
62
+ t.string :name
63
+ end
64
+
65
+ create_table :playing_cards, force: :cascade do |t|
66
+ t.string :name
67
+ end
68
+
55
69
  create_table :books, force: :cascade do |t|
56
70
  t.string :title, null: false
57
71
  t.string :publisher, null: false, default: 'Default Publisher'
data/test/test_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'pathname'
2
+ require 'rake'
2
3
  test_dir = Pathname.new File.dirname(__FILE__)
3
4
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-import
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Dennis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-20 00:00:00.000000000 Z
11
+ date: 2021-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -45,10 +45,10 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".github/workflows/test.yaml"
48
49
  - ".gitignore"
49
50
  - ".rubocop.yml"
50
51
  - ".rubocop_todo.yml"
51
- - ".travis.yml"
52
52
  - Brewfile
53
53
  - CHANGELOG.md
54
54
  - Gemfile
@@ -114,6 +114,7 @@ files:
114
114
  - test/adapters/spatialite.rb
115
115
  - test/adapters/sqlite3.rb
116
116
  - test/database.yml.sample
117
+ - test/github/database.yml
117
118
  - test/import_test.rb
118
119
  - test/jdbcmysql/import_test.rb
119
120
  - test/jdbcpostgresql/import_test.rb
@@ -125,11 +126,14 @@ files:
125
126
  - test/models/bike_maker.rb
126
127
  - test/models/book.rb
127
128
  - test/models/car.rb
129
+ - test/models/card.rb
128
130
  - test/models/chapter.rb
131
+ - test/models/deck.rb
129
132
  - test/models/dictionary.rb
130
133
  - test/models/discount.rb
131
134
  - test/models/end_note.rb
132
135
  - test/models/group.rb
136
+ - test/models/playing_card.rb
133
137
  - test/models/promotion.rb
134
138
  - test/models/question.rb
135
139
  - test/models/rule.rb
@@ -164,7 +168,6 @@ files:
164
168
  - test/support/sqlite3/import_examples.rb
165
169
  - test/synchronize_test.rb
166
170
  - test/test_helper.rb
167
- - test/travis/database.yml
168
171
  - test/value_sets_bytes_parser_test.rb
169
172
  - test/value_sets_records_parser_test.rb
170
173
  homepage: https://github.com/zdennis/activerecord-import
@@ -186,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
189
  - !ruby/object:Gem::Version
187
190
  version: '0'
188
191
  requirements: []
189
- rubygems_version: 3.0.8
192
+ rubygems_version: 3.0.9
190
193
  signing_key:
191
194
  specification_version: 4
192
195
  summary: Bulk insert extension for ActiveRecord
@@ -205,6 +208,7 @@ test_files:
205
208
  - test/adapters/spatialite.rb
206
209
  - test/adapters/sqlite3.rb
207
210
  - test/database.yml.sample
211
+ - test/github/database.yml
208
212
  - test/import_test.rb
209
213
  - test/jdbcmysql/import_test.rb
210
214
  - test/jdbcpostgresql/import_test.rb
@@ -216,11 +220,14 @@ test_files:
216
220
  - test/models/bike_maker.rb
217
221
  - test/models/book.rb
218
222
  - test/models/car.rb
223
+ - test/models/card.rb
219
224
  - test/models/chapter.rb
225
+ - test/models/deck.rb
220
226
  - test/models/dictionary.rb
221
227
  - test/models/discount.rb
222
228
  - test/models/end_note.rb
223
229
  - test/models/group.rb
230
+ - test/models/playing_card.rb
224
231
  - test/models/promotion.rb
225
232
  - test/models/question.rb
226
233
  - test/models/rule.rb
@@ -255,6 +262,5 @@ test_files:
255
262
  - test/support/sqlite3/import_examples.rb
256
263
  - test/synchronize_test.rb
257
264
  - test/test_helper.rb
258
- - test/travis/database.yml
259
265
  - test/value_sets_bytes_parser_test.rb
260
266
  - test/value_sets_records_parser_test.rb
data/.travis.yml DELETED
@@ -1,76 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.5.8
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
- - AR_VERSION=6.1
15
-
16
- matrix:
17
- include:
18
- - rvm: 2.3.8
19
- env: AR_VERSION=3.2
20
- - rvm: 2.3.8
21
- env: AR_VERSION=4.0
22
- - rvm: 2.3.8
23
- env: AR_VERSION=4.1
24
- - rvm: 2.3.8
25
- env: AR_VERSION=4.2
26
- - rvm: 2.3.8
27
- env: AR_VERSION=5.0
28
-
29
- fast_finish: true
30
-
31
- addons:
32
- postgresql: "10"
33
- apt:
34
- sources:
35
- - travis-ci/sqlite3
36
- - mysql-5.7-trusty
37
- packages:
38
- - sqlite3
39
- - mysql-server
40
- - mysql-client
41
- - postgresql-10-postgis-2.4
42
-
43
- before_install:
44
- - sudo apt-get update
45
- - gem update --system
46
- - sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
47
- - sudo mysql_upgrade
48
- - sudo service mysql restart
49
-
50
- before_script:
51
- - mysql -e 'create database activerecord_import_test;'
52
- - psql -c 'create database activerecord_import_test;' -U postgres
53
- - psql activerecord_import_test -c 'create extension if not exists hstore;' -U postgres
54
- - psql -c 'create extension if not exists postgis;' -U postgres
55
- - psql -c 'create extension if not exists "uuid-ossp";' -U postgres
56
- - cp test/travis/database.yml test/database.yml
57
-
58
- script:
59
- - bundle exec rake test:mysql2
60
- - bundle exec rake test:mysql2_makara
61
- - bundle exec rake test:mysql2spatial
62
- - bundle exec rake test:postgis
63
- - bundle exec rake test:postgresql
64
- - bundle exec rake test:postgresql_makara
65
- - bundle exec rake test:seamless_database_pool
66
- - bundle exec rake test:spatialite
67
- - bundle exec rake test:sqlite3
68
- - bundle exec rubocop
69
-
70
- dist: xenial
71
-
72
- services:
73
- - mysql
74
- - postgresql
75
-
76
- sudo: required