surus 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/generators/surus/hstore/templates/install_hstore.rb +3 -3
- data/lib/surus/array/scope.rb +2 -2
- data/lib/surus/hstore/scope.rb +7 -7
- data/lib/surus/version.rb +1 -1
- metadata +15 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3aff7e0e8b000df98229acb0c68f228f94ca85d
|
4
|
+
data.tar.gz: dec38237d5576383026aae08b756084686c0584b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6ffb1bbac2326e6a07ab64340d94414c68f7b34fd921b2570091a02b83638092d26381590617b8b156a108a84f5256e1c938d64c516b0b8c640c03905a41251
|
7
|
+
data.tar.gz: a38ecc94ac49448b5039f8aac1c18f665575fa912ad3a44224ac4cefc7e209adac1fb70498d4a6a8952a013fe4f4eb88aaa81d1857c4085e9873a3ecf6504e1b
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@ class InstallHstore < ActiveRecord::Migration
|
|
3
3
|
version = ActiveRecord::Base.connection.send(:postgresql_version)
|
4
4
|
# check for newer versions
|
5
5
|
if version >= 90100
|
6
|
-
sql = "CREATE EXTENSION hstore"
|
6
|
+
sql = "CREATE EXTENSION IF NOT EXISTS hstore"
|
7
7
|
# use the hstore.sql file on the system, if found
|
8
8
|
elsif(path = hstore_sql_path)
|
9
9
|
sql = File.read(path)
|
@@ -29,7 +29,7 @@ private
|
|
29
29
|
rescue Errno::ENOENT # if `pg_config` fails
|
30
30
|
nil
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def default_sql
|
34
34
|
hstore_sql = <<-HSTORE_SQL
|
35
35
|
/* $PostgreSQL: pgsql/contrib/hstore/hstore.sql.in,v 1.11 2009/06/11 18:30:03 tgl Exp $ */
|
@@ -299,6 +299,6 @@ AS
|
|
299
299
|
FUNCTION 4 gin_consistent_hstore(internal, int2, internal, int4, internal, internal),
|
300
300
|
STORAGE text;
|
301
301
|
HSTORE_SQL
|
302
|
-
|
302
|
+
|
303
303
|
end
|
304
304
|
end
|
data/lib/surus/array/scope.rb
CHANGED
@@ -8,7 +8,7 @@ module Surus
|
|
8
8
|
# User.array_has(:permissions, "manage_users", "manage_roles")
|
9
9
|
# User.array_has(:permissions, ["manage_users", "manage_roles"])
|
10
10
|
def array_has(column, *values)
|
11
|
-
where("#{connection.quote_column_name(column)} @> ARRAY[?]#{array_cast(column)}", values.flatten)
|
11
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} @> ARRAY[?]#{array_cast(column)}", values.flatten)
|
12
12
|
end
|
13
13
|
|
14
14
|
# Adds where condition that requires column to contain any values
|
@@ -18,7 +18,7 @@ module Surus
|
|
18
18
|
# User.array_has_any(:permissions, "manage_users", "manage_roles")
|
19
19
|
# User.array_has_any(:permissions, ["manage_users", "manage_roles"])
|
20
20
|
def array_has_any(column, *values)
|
21
|
-
where("#{connection.quote_column_name(column)} && ARRAY[?]#{array_cast(column)}", values.flatten)
|
21
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} && ARRAY[?]#{array_cast(column)}", values.flatten)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
data/lib/surus/hstore/scope.rb
CHANGED
@@ -6,33 +6,33 @@ module Surus
|
|
6
6
|
# Example:
|
7
7
|
# User.hstore_has_pairs(:properties, "favorite_color" => "green")
|
8
8
|
def hstore_has_pairs(column, hash)
|
9
|
-
where("#{connection.quote_column_name(column)} @> ?", Serializer.new.dump(hash))
|
9
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} @> ?", Serializer.new.dump(hash))
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
# Adds a where condition that requires column to contain key
|
13
13
|
#
|
14
14
|
# Example:
|
15
15
|
# User.hstore_has_key(:properties, "favorite_color")
|
16
16
|
def hstore_has_key(column, key)
|
17
|
-
where("#{connection.quote_column_name(column)} ? :key", :key => key)
|
17
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} ? :key", :key => key)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
# Adds a where condition that requires column to contain all keys.
|
21
21
|
#
|
22
22
|
# Example:
|
23
23
|
# User.hstore_has_all_keys(:properties, "favorite_color", "favorite_song")
|
24
24
|
# User.hstore_has_all_keys(:properties, ["favorite_color", "favorite_song"])
|
25
25
|
def hstore_has_all_keys(column, *keys)
|
26
|
-
where("#{connection.quote_column_name(column)} ?& ARRAY[:keys]", :keys => keys.flatten)
|
26
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} ?& ARRAY[:keys]", :keys => keys.flatten)
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
# Adds a where condition that requires column to contain any keys.
|
30
30
|
#
|
31
31
|
# Example:
|
32
32
|
# User.hstore_has_any_keys(:properties, "favorite_color", "favorite_song")
|
33
33
|
# User.hstore_has_any_keys(:properties, ["favorite_color", "favorite_song"])
|
34
34
|
def hstore_has_any_keys(column, *keys)
|
35
|
-
where("#{connection.quote_column_name(column)} ?| ARRAY[:keys]", :keys => keys.flatten)
|
35
|
+
where("#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column)} ?| ARRAY[:keys]", :keys => keys.flatten)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/surus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: surus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Christensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -243,8 +243,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project: ''
|
246
|
-
rubygems_version: 2.4.5
|
246
|
+
rubygems_version: 2.4.5.1
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: PostgreSQL Acceleration for ActiveRecord
|
250
|
-
test_files:
|
250
|
+
test_files:
|
251
|
+
- spec/array/scope_spec.rb
|
252
|
+
- spec/database.yml
|
253
|
+
- spec/database.yml.travis
|
254
|
+
- spec/database_structure.sql
|
255
|
+
- spec/factories.rb
|
256
|
+
- spec/hstore/scope_spec.rb
|
257
|
+
- spec/hstore/serializer_spec.rb
|
258
|
+
- spec/json/json_spec.rb
|
259
|
+
- spec/spec_helper.rb
|
260
|
+
- spec/synchronous_commit/connection_spec.rb
|
261
|
+
- spec/synchronous_commit/model_spec.rb
|