sample_data_dump_postgres_data_store 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 156cad5b2ebd342e4d30290fd561d327b4639dc7
4
- data.tar.gz: 49cd3561612b59c104aeae6bf2f61cc704163362
3
+ metadata.gz: 3d8a276f15201c22d81c1f18ee982c603d4cc990
4
+ data.tar.gz: 24e6ba2621388ddf9d5240bb8127c4251e21aaf4
5
5
  SHA512:
6
- metadata.gz: 47336fe15b95530d7de7718ac1211649f65ab4637e75df8eb20e93ca84a484fd383a65b0d30a91747ab0416845a4a7f49161d32487ef109de2f8493c13f5e3a5
7
- data.tar.gz: b3d621b6a6a4c59912a76ee93300c754fd89782f6a59e32d3a339c45bf09c6614ab776f0ac38d5b46ddfdfc239bc9981f98a85e7094357091164e93028718fa0
6
+ metadata.gz: e814651e54f2534bf09d148f1e7e74fd3c53b8704fc9976a889ce7d1a55d1c84259bcf17cd741b745fb677636536cdd4595f4091e901a03b33378f663de88385
7
+ data.tar.gz: de06dde145eebab4a1e9ad02f3fa870bbe4d735a5c3464aed308ae628ce500a19fb6ae0e12a575167068b27fa1bd4104e90d51e68a8235ff4e247f8deafcee8e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.4
2
+
3
+ * Handle inconsistently named or nonexistent sequences
4
+
1
5
  0.0.3
2
6
 
3
7
  * Fixed bug where spaces were being stripped out of data
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sample_data_dump_postgres_data_store (0.0.3)
4
+ sample_data_dump_postgres_data_store (0.0.4)
5
5
  activerecord
6
6
  dry-matcher
7
7
  dry-monads
@@ -156,7 +156,7 @@ GEM
156
156
  rake (>= 0.8.7)
157
157
  thor (>= 0.19.0, < 2.0)
158
158
  rainbow (3.0.0)
159
- rake (12.3.1)
159
+ rake (12.3.2)
160
160
  rb-fsevent (0.10.3)
161
161
  rb-inotify (0.9.10)
162
162
  ffi (>= 0.5.0, < 2)
@@ -179,7 +179,7 @@ GEM
179
179
  diff-lcs (>= 1.2.0, < 2.0)
180
180
  rspec-support (~> 3.8.0)
181
181
  rspec-support (3.8.0)
182
- rubocop (0.60.0)
182
+ rubocop (0.61.1)
183
183
  jaro_winkler (~> 1.5.1)
184
184
  parallel (~> 1.10)
185
185
  parser (>= 2.5, != 2.5.1.1)
@@ -42,8 +42,14 @@ module SampleDataDumpPostgresDataStore
42
42
 
43
43
  def reset_sequence(table_configuration)
44
44
  table_name = table_configuration.qualified_table_name
45
- sql = "SELECT setval('#{table_name}_id_seq', coalesce((SELECT MAX(id) FROM #{table_name}),1))"
46
- @postgresql_adapter.execute(sql)
45
+ get_sequence_name_sql = "SELECT PG_GET_SERIAL_SEQUENCE('#{table_name}', 'id') AS name"
46
+ sequence_name = @postgresql_adapter.execute(get_sequence_name_sql).first['name']
47
+ if sequence_name.present?
48
+ sql = "SELECT setval('#{sequence_name}', coalesce((SELECT MAX(id) FROM #{table_name}),1))"
49
+ @postgresql_adapter.execute(sql)
50
+ end
51
+ Dry::Monads::Success(true)
52
+ rescue ActiveRecord::StatementInvalid # means sequence or column does not exist
47
53
  Dry::Monads::Success(true)
48
54
  end
49
55
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SampleDataDumpPostgresDataStore
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sample_data_dump_postgres_data_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bellroy Dev Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord