sequel-from_csv 0.2.0 → 0.3.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: 3706abc5bcbc730c436d702292e8a7ace38ad3419c73ae9deb82f6b6cc0e3b56
4
- data.tar.gz: 759e60fa7eec0007d63df5eef240917dad0174ee9b86f5a4ebba5b7d8b8fb09e
3
+ metadata.gz: 8486d07dffd74cc99acc09f50b2d328a400d7184a4bb01cf3f9e65137f123c1a
4
+ data.tar.gz: 7864b520d687801d1632ae51c9f30088a32630b9b3cff3a8adeeda8c2f815ad4
5
5
  SHA512:
6
- metadata.gz: 8dfbd463ee485c63aba9e405d9b3fed23fa4578bf5ff9109d3521af5162dc531c8c6f3a4ea4a2be6480e2dd7737a43c53c23c9e1e0a667f0f3cf2903cc707574
7
- data.tar.gz: f148140f6ad0c12deb8ec902e415cf5575f6226d7d617e2c5a2a67454a2b0598295a1a9dc3c82bf43d9b7f020eb853173fefb9eb9a134d18ecd1803efc6576ce
6
+ metadata.gz: d9d063f09423177c125a09313c98817ec238f49efacdcfd6880f10fdd0cd09f4e64755c641445c791532868df1e420bb14f79faea27c92d87bfb24a550866359
7
+ data.tar.gz: '099c7c16f203f9c5c63e2dfd22622929416fe582f39d66e6377af02544b0ad5b20a86570a2b65b1f3b60f2274206cf7fb80d345ffd9d2dc29f39c197e89db1e3'
@@ -14,9 +14,9 @@ module Sequel
14
14
  #
15
15
  # *Options:*
16
16
  # :delete_missing :: whether to remove rows from the table that were not found in the CSV file
17
- # :reset_sequence :: whether to update the primary key's sequence to reflect the max primary key value
17
+ # :resequence :: whether to update the primary key's sequence to reflect the max primary key value
18
18
  #
19
- # :reset_sequence only works on PostgreSQL tables that auto-increment their primary keys using sequences
19
+ # :resequence only works on PostgreSQL tables that auto-increment their primary keys using sequences
20
20
  def seed_from_csv directory, **opts
21
21
 
22
22
  Dir.glob("#{directory}/**/*.csv").each do |filename|
@@ -17,16 +17,16 @@ module Sequel
17
17
  #
18
18
  # *Options:*
19
19
  # :delete_missing :: whether to remove rows from the table that were not found in the CSV file
20
- # :reset_sequence :: whether to update the primary key's sequence to reflect the max primary key value
20
+ # :resequence :: whether to update the primary key's sequence to reflect the max primary key value
21
21
  #
22
- # :reset_sequence only works on PostgreSQL tables that auto-increment their primary keys using sequences
22
+ # :resequence only works on PostgreSQL tables that auto-increment their primary keys using sequences
23
23
  #
24
24
  # *Usage:*
25
25
  # class Artist < Sequel::Model
26
26
  # plugin :from_csv
27
27
  # end
28
- # Artist.seed_from_csv "seeds/artists.csv", reset_sequence: true
29
- def seed_from_csv csv_path, delete_missing: false, reset_sequence: false
28
+ # Artist.seed_from_csv "seeds/artists.csv", resequence: true
29
+ def seed_from_csv csv_path, delete_missing: false, resequence: false
30
30
 
31
31
  # Read the source CSV file
32
32
  data = CSV.table csv_path, converters: :date_time
@@ -61,7 +61,7 @@ module Sequel
61
61
  end
62
62
 
63
63
  # Update the table's sequence
64
- if reset_sequence
64
+ if resequence
65
65
  case self.db.database_type
66
66
  when :postgres
67
67
  self.db.run <<~SQL
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-from_csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenaniah Cerny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2018-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport