upsert 1.1.3 → 1.1.4
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.
- data/CHANGELOG +6 -0
- data/README.md +1 -1
- data/lib/upsert/connection/postgresql.rb +2 -2
- data/lib/upsert/version.rb +1 -1
- data/spec/hstore_spec.rb +5 -5
- data/upsert.gemspec +1 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -5,8 +5,8 @@ class Upsert
|
|
5
5
|
def bind_value(v)
|
6
6
|
case v
|
7
7
|
when Hash
|
8
|
-
# you must require '
|
9
|
-
::
|
8
|
+
# you must require 'pg_hstore' from the 'pg-hstore' gem yourself
|
9
|
+
::PgHstore.dump(v)[1...-1]
|
10
10
|
else
|
11
11
|
super
|
12
12
|
end
|
data/lib/upsert/version.rb
CHANGED
data/spec/hstore_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
describe Upsert do
|
3
3
|
describe 'hstore on pg' do
|
4
4
|
it "just works" do
|
5
|
-
require '
|
5
|
+
require 'pg_hstore'
|
6
6
|
Pet.connection.execute 'CREATE EXTENSION HSTORE'
|
7
7
|
Pet.connection.execute "ALTER TABLE pets ADD COLUMN crazy HSTORE"
|
8
8
|
upsert = Upsert.new $conn, :pets
|
@@ -13,7 +13,7 @@ describe Upsert do
|
|
13
13
|
|
14
14
|
upsert.row({name: 'Bill'}, crazy: {a: 1})
|
15
15
|
row = Pet.connection.select_one(%{SELECT crazy FROM pets WHERE name = 'Bill'})
|
16
|
-
crazy =
|
16
|
+
crazy = PgHstore.parse row['crazy']
|
17
17
|
crazy.should == { a: '1' }
|
18
18
|
|
19
19
|
upsert.row({name: 'Bill'}, crazy: nil)
|
@@ -22,17 +22,17 @@ describe Upsert do
|
|
22
22
|
|
23
23
|
upsert.row({name: 'Bill'}, crazy: {a: 1})
|
24
24
|
row = Pet.connection.select_one(%{SELECT crazy FROM pets WHERE name = 'Bill'})
|
25
|
-
crazy =
|
25
|
+
crazy = PgHstore.parse row['crazy']
|
26
26
|
crazy.should == { a: '1' }
|
27
27
|
|
28
28
|
upsert.row({name: 'Bill'}, crazy: {whatdat: 'whodat'})
|
29
29
|
row = Pet.connection.select_one(%{SELECT crazy FROM pets WHERE name = 'Bill'})
|
30
|
-
crazy =
|
30
|
+
crazy = PgHstore.parse row['crazy']
|
31
31
|
crazy.should == { a: '1', whatdat: 'whodat' }
|
32
32
|
|
33
33
|
upsert.row({name: 'Bill'}, crazy: {a: 2})
|
34
34
|
row = Pet.connection.select_one(%{SELECT crazy FROM pets WHERE name = 'Bill'})
|
35
|
-
crazy =
|
35
|
+
crazy = PgHstore.parse row['crazy']
|
36
36
|
crazy.should == { a: '2', whatdat: 'whodat' }
|
37
37
|
end
|
38
38
|
end
|
data/upsert.gemspec
CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_development_dependency 'yard'
|
29
29
|
gem.add_development_dependency 'activerecord-import'
|
30
30
|
gem.add_development_dependency 'pry'
|
31
|
-
gem.add_development_dependency 'pg-hstore'
|
31
|
+
gem.add_development_dependency 'pg-hstore', ">=1.1.0"
|
32
32
|
|
33
33
|
unless RUBY_VERSION >= '1.9'
|
34
34
|
gem.add_development_dependency 'orderedhash'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upsert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|
@@ -162,7 +162,7 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - ! '>='
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 1.1.0
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -170,7 +170,7 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ! '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 1.1.0
|
174
174
|
- !ruby/object:Gem::Dependency
|
175
175
|
name: sqlite3
|
176
176
|
requirement: !ruby/object:Gem::Requirement
|