seed-fu 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/seed-fu/seeder.rb +12 -4
- data/lib/seed-fu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e6088097d2c661a122bb7e45b22c42d7977762b
|
4
|
+
data.tar.gz: ed6f3905960a6c9ea1c39642edfda83abe6b2cd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f47a07938cb3371fbd94b2136c4fe237879fa607baae0ad68cd455581b28c6b8a301f99bfdc408b3b7a212490cc22828c5966a216bad27a8d71cacdf35883e
|
7
|
+
data.tar.gz: f891abb4e51a7d3568efdd8deed6d514658f9e271922a9490c7469c192bfd2731c1abde1550b2622180b3f2305882e3d2fe941956a8a0476332abca8ec67b803
|
data/CHANGELOG.md
CHANGED
data/lib/seed-fu/seeder.rb
CHANGED
@@ -85,15 +85,23 @@ module SeedFu
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def update_id_sequence
|
88
|
-
if @model_class.connection.adapter_name == "PostgreSQL"
|
88
|
+
if @model_class.connection.adapter_name == "PostgreSQL" or @model_class.connection.adapter_name == "PostGIS"
|
89
89
|
return if @model_class.primary_key.nil? || @model_class.sequence_name.nil?
|
90
90
|
|
91
91
|
quoted_id = @model_class.connection.quote_column_name(@model_class.primary_key)
|
92
92
|
sequence = @model_class.sequence_name
|
93
93
|
|
94
|
-
@model_class.connection.
|
95
|
-
|
96
|
-
|
94
|
+
if @model_class.connection.postgresql_version >= 100000
|
95
|
+
sql =<<-EOS
|
96
|
+
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT seqincrement FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass), (SELECT seqmin FROM pg_sequence WHERE seqrelid = '#{sequence}'::regclass)) FROM #{@model_class.quoted_table_name}), false)
|
97
|
+
EOS
|
98
|
+
else
|
99
|
+
sql =<<-EOS
|
100
|
+
SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
|
101
|
+
EOS
|
102
|
+
end
|
103
|
+
|
104
|
+
@model_class.connection.execute sql
|
97
105
|
end
|
98
106
|
end
|
99
107
|
end
|
data/lib/seed-fu/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seed-fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|