postgres_ext 1.0.0 → 2.0.0
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +6 -47
- data/lib/postgres_ext/active_record/relation/predicate_builder.rb +36 -55
- data/lib/postgres_ext/active_record/relation/query_methods.rb +0 -14
- data/lib/postgres_ext/active_record.rb +0 -3
- data/lib/postgres_ext/version.rb +1 -1
- data/postgres_ext.gemspec +6 -5
- data/spec/arel/arel_spec.rb +0 -1
- data/spec/dummy/app/models/person.rb +0 -1
- data/spec/dummy/config/application.rb +0 -3
- data/spec/dummy/config/environments/development.rb +2 -7
- data/spec/dummy/config/environments/production.rb +1 -0
- data/spec/dummy/config/environments/test.rb +1 -5
- data/spec/dummy/db/migrate/20120501163758_create_people.rb +3 -3
- data/spec/dummy/db/schema.rb +15 -12
- data/spec/queries/sanity_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- metadata +21 -105
- data/docs/indexes.md +0 -28
- data/docs/migrations.md +0 -92
- data/docs/type_casting.md +0 -70
- data/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb +0 -537
- data/lib/postgres_ext/active_record/connection_adapters.rb +0 -1
- data/lib/postgres_ext/active_record/sanitization.rb +0 -30
- data/lib/postgres_ext/active_record/schema_dumper.rb +0 -157
- data/spec/columns/array_spec.rb +0 -119
- data/spec/columns/inet_spec.rb +0 -25
- data/spec/columns/ranges/daterange_spec.rb +0 -37
- data/spec/columns/ranges/int4range_spec.rb +0 -38
- data/spec/columns/ranges/int8range_spec.rb +0 -38
- data/spec/columns/ranges/numrange_spec.rb +0 -37
- data/spec/columns/ranges/tsrange_spec.rb +0 -37
- data/spec/migrations/active_record_migration_spec.rb +0 -29
- data/spec/migrations/array_spec.rb +0 -214
- data/spec/migrations/cidr_spec.rb +0 -26
- data/spec/migrations/citext_spec.rb +0 -32
- data/spec/migrations/ean13_spec.rb +0 -27
- data/spec/migrations/index_spec.rb +0 -67
- data/spec/migrations/inet_spec.rb +0 -26
- data/spec/migrations/macaddr_spec.rb +0 -26
- data/spec/migrations/ranges/daterange_spec.rb +0 -27
- data/spec/migrations/ranges/int4range_spec.rb +0 -27
- data/spec/migrations/ranges/int8range_spec.rb +0 -27
- data/spec/migrations/ranges/numrange_spec.rb +0 -27
- data/spec/migrations/ranges/tsrange_spec.rb +0 -27
- data/spec/migrations/ranges/tstzrange_spec.rb +0 -27
- data/spec/migrations/uuid_spec.rb +0 -26
- data/spec/models/array_spec.rb +0 -285
- data/spec/models/ean13_spec.rb +0 -57
- data/spec/models/inet_spec.rb +0 -88
- data/spec/models/ranges/daterange_spec.rb +0 -88
- data/spec/models/ranges/int4range_spec.rb +0 -85
- data/spec/models/ranges/int8range_spec.rb +0 -85
- data/spec/models/ranges/numrange_spec.rb +0 -85
- data/spec/models/ranges/tsrange_spec.rb +0 -89
- data/spec/models/ranges/tstzrange_spec.rb +0 -89
- data/spec/schema_dumper/array_spec.rb +0 -17
- data/spec/schema_dumper/cidr_spec.rb +0 -17
- data/spec/schema_dumper/citext_spec.rb +0 -17
- data/spec/schema_dumper/ean13_spec.rb +0 -17
- data/spec/schema_dumper/extension_spec.rb +0 -14
- data/spec/schema_dumper/index_spec.rb +0 -46
- data/spec/schema_dumper/inet_spec.rb +0 -17
- data/spec/schema_dumper/macaddr_spec.rb +0 -17
- data/spec/schema_dumper/ranges/daterange_spec.rb +0 -18
- data/spec/schema_dumper/ranges/int4range_spec.rb +0 -18
- data/spec/schema_dumper/ranges/int8range_spec.rb +0 -18
- data/spec/schema_dumper/ranges/numrange_spec.rb +0 -18
- data/spec/schema_dumper/ranges/tsrange_spec.rb +0 -18
- data/spec/schema_dumper/ranges/tstzrange_spec.rb +0 -17
- data/spec/schema_dumper/uuid_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a9a614595cf23330e0ef345abaa250b7c22ce4
|
4
|
+
data.tar.gz: a76e0358088afb3a32ee35acedf993178887a323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d72d5bb3c07f5ff7a41dabe3a2bc4ee2c825b4868ad8f55ca6e8b147dcd35b71543f0a2f3fadaf364a5a77a7799cbe2ed8a440b2a0e4d2758605a573c6349499
|
7
|
+
data.tar.gz: bd734f9475b84bee09f43d8b8c6c6f076455ffc65f1a9bc66965391af9ea51a88156dba5c36a816cb395c8627adc65188d23357cbfc2b1641bd0181871d507b5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# PostgresExt
|
2
2
|
|
3
|
-
Adds
|
3
|
+
Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel for Rails 4.x
|
4
4
|
|
5
5
|
[](http://travis-ci.org/dockyard/postgres_ext)
|
6
6
|
[](https://codeclimate.com/github/dockyard/postgres_ext)
|
@@ -30,55 +30,14 @@ Or install it yourself as:
|
|
30
30
|
## Usage
|
31
31
|
|
32
32
|
Just `require 'postgres_ext'` and use ActiveRecord as you normally would! postgres\_ext extends
|
33
|
-
ActiveRecord's data type handling
|
33
|
+
ActiveRecord's data type handling and query methods in both Arel and
|
34
|
+
ActiveRecord.
|
34
35
|
|
35
|
-
* [Migration/Schema.rb support](docs/migrations.md)
|
36
|
-
* [Type Casting support](docs/type_casting.md)
|
37
36
|
* [Querying PostgreSQL datatypes](docs/querying.md)
|
38
|
-
* [Indexes](docs/indexes.md)
|
39
|
-
|
40
|
-
## Usage Notes
|
41
|
-
Avoid the use of in place operators (ie `Array#<<`). These changes are
|
42
|
-
*not* tracked by Rails ([this issue](https://github.com/rails/rails/issues/6954))
|
43
|
-
explains why). In place modifications also modify the default object.
|
44
|
-
|
45
|
-
Assuming we have the following model:
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
create_table :items do |t|
|
49
|
-
t.string :names, :array => true, :default => []
|
50
|
-
end
|
51
|
-
|
52
|
-
class Item < ActiveRecord::Base
|
53
|
-
end
|
54
|
-
```
|
55
|
-
|
56
|
-
The following will modify the default value of the names attribute.
|
57
|
-
|
58
|
-
```ruby
|
59
|
-
a = Item.new
|
60
|
-
a.names << 'foo'
|
61
|
-
|
62
|
-
b = Item.new
|
63
|
-
puts b.names
|
64
|
-
# => ['foo']
|
65
|
-
```
|
66
|
-
|
67
|
-
The supported way of modifying `a.names`:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
a = Item.new
|
71
|
-
a.names += ['foo']
|
72
|
-
|
73
|
-
b = Item.new
|
74
|
-
puts b.names
|
75
|
-
# => []
|
76
|
-
```
|
77
|
-
|
78
|
-
As a result, in place operators are discouraged and will not be
|
79
|
-
supported in postgres\_ext at this time.
|
80
|
-
|
81
37
|
|
38
|
+
Where are the datatypes from PostgresExt 1.x? ActiveRecord 4.x includes
|
39
|
+
all the data types that PostgresExt added to ActiveRecord 3.2.x. We'll
|
40
|
+
be adding more datatypes as we come across them.
|
82
41
|
|
83
42
|
## Authors
|
84
43
|
|
@@ -2,70 +2,51 @@ require 'active_record/relation/predicate_builder'
|
|
2
2
|
|
3
3
|
module ActiveRecord
|
4
4
|
class PredicateBuilder # :nodoc:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
else
|
15
|
-
build_from_hash(engine, value, table, false)
|
16
|
-
end
|
5
|
+
private
|
6
|
+
|
7
|
+
def self.build(attribute, value)
|
8
|
+
case value
|
9
|
+
when Array
|
10
|
+
engine = attribute.relation.engine
|
11
|
+
column = engine.columns.detect{ |col| col.name == attribute.name }
|
12
|
+
if column.array
|
13
|
+
attribute.eq(value)
|
17
14
|
else
|
18
|
-
|
19
|
-
|
20
|
-
if allow_table_name && column.include?('.')
|
21
|
-
table_name, column = column.split('.', 2)
|
22
|
-
table = Arel::Table.new(table_name, engine)
|
23
|
-
end
|
15
|
+
values = value.to_a.map {|x| x.is_a?(Base) ? x.id : x}
|
16
|
+
ranges, values = values.partition {|v| v.is_a?(Range)}
|
24
17
|
|
25
|
-
|
18
|
+
values_predicate = if values.include?(nil)
|
19
|
+
values = values.compact
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
column_definition = engine.connection.columns(table.name).find { |col| col.name == column }
|
33
|
-
|
34
|
-
if column_definition.respond_to?(:array) && column_definition.array
|
35
|
-
attribute.eq(value)
|
21
|
+
case values.length
|
22
|
+
when 0
|
23
|
+
attribute.eq(nil)
|
24
|
+
when 1
|
25
|
+
attribute.eq(values.first).or(attribute.eq(nil))
|
36
26
|
else
|
37
|
-
values
|
38
|
-
ranges, values = values.partition {|v| v.is_a?(Range) || v.is_a?(Arel::Relation)}
|
39
|
-
|
40
|
-
array_predicates = ranges.map {|range| attribute.in(range)}
|
41
|
-
|
42
|
-
if values.include?(nil)
|
43
|
-
values = values.compact
|
44
|
-
if values.empty?
|
45
|
-
array_predicates << attribute.eq(nil)
|
46
|
-
else
|
47
|
-
array_predicates << attribute.in(values.compact).or(attribute.eq(nil))
|
48
|
-
end
|
49
|
-
else
|
50
|
-
array_predicates << attribute.in(values)
|
51
|
-
end
|
52
|
-
|
53
|
-
array_predicates.inject {|composite, predicate| composite.or(predicate)}
|
27
|
+
attribute.in(values).or(attribute.eq(nil))
|
54
28
|
end
|
55
|
-
when Range, Arel::Relation
|
56
|
-
attribute.in(value)
|
57
|
-
when ActiveRecord::Base
|
58
|
-
attribute.eq(value.id)
|
59
|
-
when Class
|
60
|
-
# FIXME: I think we need to deprecate this behavior
|
61
|
-
attribute.eq(value.name)
|
62
29
|
else
|
63
|
-
attribute.
|
30
|
+
attribute.in(values)
|
64
31
|
end
|
32
|
+
|
33
|
+
array_predicates = ranges.map { |range| attribute.in(range) }
|
34
|
+
array_predicates << values_predicate
|
35
|
+
array_predicates.inject { |composite, predicate| composite.or(predicate) }
|
65
36
|
end
|
37
|
+
when ActiveRecord::Relation
|
38
|
+
value = value.select(value.klass.arel_table[value.klass.primary_key]) if value.select_values.empty?
|
39
|
+
attribute.in(value.arel.ast)
|
40
|
+
when Range
|
41
|
+
attribute.in(value)
|
42
|
+
when ActiveRecord::Base
|
43
|
+
attribute.eq(value.id)
|
44
|
+
when Class
|
45
|
+
# FIXME: I think we need to deprecate this behavior
|
46
|
+
attribute.eq(value.name)
|
47
|
+
else
|
48
|
+
attribute.eq(value)
|
66
49
|
end
|
67
|
-
|
68
|
-
predicates.flatten
|
69
50
|
end
|
70
51
|
end
|
71
52
|
end
|
@@ -3,10 +3,6 @@ require 'active_record/relation/query_methods'
|
|
3
3
|
module ActiveRecord
|
4
4
|
module QueryMethods
|
5
5
|
class WhereChain
|
6
|
-
def initialize(scope)
|
7
|
-
@scope = scope
|
8
|
-
end
|
9
|
-
|
10
6
|
def overlap(opts)
|
11
7
|
opts.each do |key, value|
|
12
8
|
@scope = @scope.where(arel_table[key].overlap(value))
|
@@ -70,15 +66,5 @@ module ActiveRecord
|
|
70
66
|
@scope
|
71
67
|
end
|
72
68
|
end
|
73
|
-
|
74
|
-
def where_with_chaining(*opts, &block)
|
75
|
-
if opts.empty? && !block_given?
|
76
|
-
WhereChain.new(self)
|
77
|
-
else
|
78
|
-
where_without_chaining(*opts, &block)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
alias_method_chain :where, :chaining
|
83
69
|
end
|
84
70
|
end
|
data/lib/postgres_ext/version.rb
CHANGED
data/postgres_ext.gemspec
CHANGED
@@ -4,7 +4,7 @@ require File.expand_path('../lib/postgres_ext/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Dan McClain"]
|
6
6
|
gem.email = ["git@danmcclain.net"]
|
7
|
-
gem.description = %q{Adds missing native PostgreSQL data types to ActiveRecord}
|
7
|
+
gem.description = %q{Adds missing native PostgreSQL data types to ActiveRecord and convenient querying extensions for ActiveRecord and Arel}
|
8
8
|
gem.summary = %q{Extends ActiveRecord to handle native PostgreSQL data types}
|
9
9
|
gem.homepage = ""
|
10
10
|
gem.licenses = ['MIT']
|
@@ -16,15 +16,16 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = PostgresExt::VERSION
|
18
18
|
|
19
|
-
gem.add_dependency 'activerecord', '~>
|
19
|
+
gem.add_dependency 'activerecord', '~> 4.0.0'
|
20
|
+
gem.add_dependency 'arel', '~> 4.0.0'
|
20
21
|
gem.add_dependency 'pg_array_parser', '~> 0.0.9'
|
21
22
|
|
22
|
-
gem.add_development_dependency 'rails', '~>
|
23
|
+
gem.add_development_dependency 'rails', '~> 4.0.0'
|
23
24
|
gem.add_development_dependency 'rspec-rails', '~> 2.12.0'
|
24
25
|
gem.add_development_dependency 'bourne', '~> 1.3.0'
|
25
26
|
if RUBY_PLATFORM =~ /java/
|
26
|
-
|
27
|
+
gem.add_development_dependency 'activerecord-jdbcpostgresql-adapter', '1.3.0.beta2'
|
27
28
|
else
|
28
|
-
|
29
|
+
gem.add_development_dependency 'pg', '~> 0.13.2'
|
29
30
|
end
|
30
31
|
end
|
data/spec/arel/arel_spec.rb
CHANGED
@@ -47,9 +47,6 @@ module Dummy
|
|
47
47
|
# Enforce whitelist mode for mass assignment.
|
48
48
|
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
49
49
|
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
50
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
51
|
-
config.active_record.whitelist_attributes = true
|
52
|
-
|
53
50
|
# Enable the asset pipeline
|
54
51
|
config.assets.enabled = true
|
55
52
|
|
@@ -1,14 +1,12 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
require 'debugger' if RUBY_VERSION == '1.9.3' && ! ENV['CI']
|
3
2
|
# Settings specified here will take precedence over those in config/application.rb
|
4
3
|
|
5
4
|
# In the development environment your application's code is reloaded on
|
6
5
|
# every request. This slows down response time but is perfect for development
|
7
6
|
# since you don't have to restart the web server when you make code changes.
|
8
7
|
config.cache_classes = false
|
9
|
-
|
10
|
-
|
11
|
-
config.whiny_nils = true
|
8
|
+
|
9
|
+
config.eager_load = false
|
12
10
|
|
13
11
|
# Show full error reports and disable caching
|
14
12
|
config.consider_all_requests_local = true
|
@@ -23,9 +21,6 @@ Dummy::Application.configure do
|
|
23
21
|
# Only use best-standards-support built into browsers
|
24
22
|
config.action_dispatch.best_standards_support = :builtin
|
25
23
|
|
26
|
-
# Raise exception on mass assignment protection for Active Record models
|
27
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
28
|
-
|
29
24
|
# Log the query plan for queries taking more than this (works
|
30
25
|
# with SQLite, MySQL, and PostgreSQL)
|
31
26
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
@@ -11,8 +11,7 @@ Dummy::Application.configure do
|
|
11
11
|
config.serve_static_assets = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
13
|
|
14
|
-
|
15
|
-
config.whiny_nils = true
|
14
|
+
config.eager_load = false
|
16
15
|
|
17
16
|
# Show full error reports and disable caching
|
18
17
|
config.consider_all_requests_local = true
|
@@ -29,9 +28,6 @@ Dummy::Application.configure do
|
|
29
28
|
# ActionMailer::Base.deliveries array.
|
30
29
|
config.action_mailer.delivery_method = :test
|
31
30
|
|
32
|
-
# Raise exception on mass assignment protection for Active Record models
|
33
|
-
config.active_record.mass_assignment_sanitizer = :strict
|
34
|
-
|
35
31
|
# Print deprecation notices to the stderr
|
36
32
|
config.active_support.deprecation = :stderr
|
37
33
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreatePeople < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :people do |t|
|
4
|
-
t.
|
5
|
-
t.
|
4
|
+
t.column :ip, :inet
|
5
|
+
t.column :subnet, :cidr
|
6
6
|
t.integer :tag_ids, :array => true
|
7
7
|
t.string :tags, :array => true
|
8
8
|
t.text :biography
|
9
9
|
t.integer :lucky_number
|
10
|
-
t.
|
10
|
+
t.column :num_range, :numrange
|
11
11
|
|
12
12
|
t.timestamps
|
13
13
|
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -9,20 +9,23 @@
|
|
9
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
11
|
#
|
12
|
-
# It's strongly recommended
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:
|
14
|
+
ActiveRecord::Schema.define(version: 20120501163758) do
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
t.
|
21
|
-
t.
|
22
|
-
t.integer
|
23
|
-
t.
|
24
|
-
t.
|
25
|
-
t.
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
|
19
|
+
create_table "people", force: true do |t|
|
20
|
+
t.inet "ip"
|
21
|
+
t.cidr "subnet"
|
22
|
+
t.integer "tag_ids", array: true
|
23
|
+
t.string "tags", array: true
|
24
|
+
t.text "biography"
|
25
|
+
t.integer "lucky_number"
|
26
|
+
t.numrange "num_range"
|
27
|
+
t.datetime "created_at"
|
28
|
+
t.datetime "updated_at"
|
26
29
|
end
|
27
30
|
|
28
31
|
end
|
data/spec/queries/sanity_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,6 @@ require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
|
5
5
|
require 'rspec/rails'
|
6
6
|
require 'rspec/autorun'
|
7
7
|
require 'bourne'
|
8
|
-
#require 'debugger' unless ENV['CI'] || (RUBY_PLATFORM =~ /java/)
|
9
8
|
|
10
9
|
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
|
11
10
|
|
@@ -15,7 +14,7 @@ Dir[File.join(ENGINE_RAILS_ROOT, 'spec/support/**/*.rb')].each { |f| require f }
|
|
15
14
|
require 'postgres_ext'
|
16
15
|
|
17
16
|
RSpec.configure do |config|
|
18
|
-
config.before(:suite) { ActiveRecord::Base.connection.
|
17
|
+
config.before(:suite) { ActiveRecord::Base.connection.enable_extension('pg_trgm')}
|
19
18
|
config.use_transactional_fixtures = false
|
20
19
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
21
20
|
config.mock_with :mocha
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan McClain
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: arel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pg_array_parser
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 4.0.0
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ~>
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 4.0.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec-rails
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +108,8 @@ dependencies:
|
|
94
108
|
- - ~>
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: 0.13.2
|
97
|
-
description: Adds missing native PostgreSQL data types to ActiveRecord
|
111
|
+
description: Adds missing native PostgreSQL data types to ActiveRecord and convenient
|
112
|
+
querying extensions for ActiveRecord and Arel
|
98
113
|
email:
|
99
114
|
- git@danmcclain.net
|
100
115
|
executables: []
|
@@ -109,19 +124,12 @@ files:
|
|
109
124
|
- Gemfile
|
110
125
|
- README.md
|
111
126
|
- Rakefile
|
112
|
-
- docs/indexes.md
|
113
|
-
- docs/migrations.md
|
114
127
|
- docs/querying.md
|
115
|
-
- docs/type_casting.md
|
116
128
|
- lib/postgres_ext.rb
|
117
129
|
- lib/postgres_ext/active_record.rb
|
118
|
-
- lib/postgres_ext/active_record/connection_adapters.rb
|
119
|
-
- lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb
|
120
130
|
- lib/postgres_ext/active_record/relation.rb
|
121
131
|
- lib/postgres_ext/active_record/relation/predicate_builder.rb
|
122
132
|
- lib/postgres_ext/active_record/relation/query_methods.rb
|
123
|
-
- lib/postgres_ext/active_record/sanitization.rb
|
124
|
-
- lib/postgres_ext/active_record/schema_dumper.rb
|
125
133
|
- lib/postgres_ext/arel.rb
|
126
134
|
- lib/postgres_ext/arel/nodes.rb
|
127
135
|
- lib/postgres_ext/arel/nodes/array_nodes.rb
|
@@ -135,13 +143,6 @@ files:
|
|
135
143
|
- spec/arel/arel_spec.rb
|
136
144
|
- spec/arel/array_spec.rb
|
137
145
|
- spec/arel/inet_spec.rb
|
138
|
-
- spec/columns/array_spec.rb
|
139
|
-
- spec/columns/inet_spec.rb
|
140
|
-
- spec/columns/ranges/daterange_spec.rb
|
141
|
-
- spec/columns/ranges/int4range_spec.rb
|
142
|
-
- spec/columns/ranges/int8range_spec.rb
|
143
|
-
- spec/columns/ranges/numrange_spec.rb
|
144
|
-
- spec/columns/ranges/tsrange_spec.rb
|
145
146
|
- spec/dummy/.gitignore
|
146
147
|
- spec/dummy/README.rdoc
|
147
148
|
- spec/dummy/Rakefile
|
@@ -193,48 +194,9 @@ files:
|
|
193
194
|
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
194
195
|
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
195
196
|
- spec/dummy/vendor/plugins/.gitkeep
|
196
|
-
- spec/migrations/active_record_migration_spec.rb
|
197
|
-
- spec/migrations/array_spec.rb
|
198
|
-
- spec/migrations/cidr_spec.rb
|
199
|
-
- spec/migrations/citext_spec.rb
|
200
|
-
- spec/migrations/ean13_spec.rb
|
201
|
-
- spec/migrations/index_spec.rb
|
202
|
-
- spec/migrations/inet_spec.rb
|
203
|
-
- spec/migrations/macaddr_spec.rb
|
204
|
-
- spec/migrations/ranges/daterange_spec.rb
|
205
|
-
- spec/migrations/ranges/int4range_spec.rb
|
206
|
-
- spec/migrations/ranges/int8range_spec.rb
|
207
|
-
- spec/migrations/ranges/numrange_spec.rb
|
208
|
-
- spec/migrations/ranges/tsrange_spec.rb
|
209
|
-
- spec/migrations/ranges/tstzrange_spec.rb
|
210
|
-
- spec/migrations/uuid_spec.rb
|
211
|
-
- spec/models/array_spec.rb
|
212
|
-
- spec/models/ean13_spec.rb
|
213
|
-
- spec/models/inet_spec.rb
|
214
|
-
- spec/models/ranges/daterange_spec.rb
|
215
|
-
- spec/models/ranges/int4range_spec.rb
|
216
|
-
- spec/models/ranges/int8range_spec.rb
|
217
|
-
- spec/models/ranges/numrange_spec.rb
|
218
|
-
- spec/models/ranges/tsrange_spec.rb
|
219
|
-
- spec/models/ranges/tstzrange_spec.rb
|
220
197
|
- spec/queries/array_queries_spec.rb
|
221
198
|
- spec/queries/contains_querie_spec.rb
|
222
199
|
- spec/queries/sanity_spec.rb
|
223
|
-
- spec/schema_dumper/array_spec.rb
|
224
|
-
- spec/schema_dumper/cidr_spec.rb
|
225
|
-
- spec/schema_dumper/citext_spec.rb
|
226
|
-
- spec/schema_dumper/ean13_spec.rb
|
227
|
-
- spec/schema_dumper/extension_spec.rb
|
228
|
-
- spec/schema_dumper/index_spec.rb
|
229
|
-
- spec/schema_dumper/inet_spec.rb
|
230
|
-
- spec/schema_dumper/macaddr_spec.rb
|
231
|
-
- spec/schema_dumper/ranges/daterange_spec.rb
|
232
|
-
- spec/schema_dumper/ranges/int4range_spec.rb
|
233
|
-
- spec/schema_dumper/ranges/int8range_spec.rb
|
234
|
-
- spec/schema_dumper/ranges/numrange_spec.rb
|
235
|
-
- spec/schema_dumper/ranges/tsrange_spec.rb
|
236
|
-
- spec/schema_dumper/ranges/tstzrange_spec.rb
|
237
|
-
- spec/schema_dumper/uuid_spec.rb
|
238
200
|
- spec/spec_helper.rb
|
239
201
|
homepage: ''
|
240
202
|
licenses:
|
@@ -264,13 +226,6 @@ test_files:
|
|
264
226
|
- spec/arel/arel_spec.rb
|
265
227
|
- spec/arel/array_spec.rb
|
266
228
|
- spec/arel/inet_spec.rb
|
267
|
-
- spec/columns/array_spec.rb
|
268
|
-
- spec/columns/inet_spec.rb
|
269
|
-
- spec/columns/ranges/daterange_spec.rb
|
270
|
-
- spec/columns/ranges/int4range_spec.rb
|
271
|
-
- spec/columns/ranges/int8range_spec.rb
|
272
|
-
- spec/columns/ranges/numrange_spec.rb
|
273
|
-
- spec/columns/ranges/tsrange_spec.rb
|
274
229
|
- spec/dummy/.gitignore
|
275
230
|
- spec/dummy/README.rdoc
|
276
231
|
- spec/dummy/Rakefile
|
@@ -322,46 +277,7 @@ test_files:
|
|
322
277
|
- spec/dummy/vendor/assets/javascripts/.gitkeep
|
323
278
|
- spec/dummy/vendor/assets/stylesheets/.gitkeep
|
324
279
|
- spec/dummy/vendor/plugins/.gitkeep
|
325
|
-
- spec/migrations/active_record_migration_spec.rb
|
326
|
-
- spec/migrations/array_spec.rb
|
327
|
-
- spec/migrations/cidr_spec.rb
|
328
|
-
- spec/migrations/citext_spec.rb
|
329
|
-
- spec/migrations/ean13_spec.rb
|
330
|
-
- spec/migrations/index_spec.rb
|
331
|
-
- spec/migrations/inet_spec.rb
|
332
|
-
- spec/migrations/macaddr_spec.rb
|
333
|
-
- spec/migrations/ranges/daterange_spec.rb
|
334
|
-
- spec/migrations/ranges/int4range_spec.rb
|
335
|
-
- spec/migrations/ranges/int8range_spec.rb
|
336
|
-
- spec/migrations/ranges/numrange_spec.rb
|
337
|
-
- spec/migrations/ranges/tsrange_spec.rb
|
338
|
-
- spec/migrations/ranges/tstzrange_spec.rb
|
339
|
-
- spec/migrations/uuid_spec.rb
|
340
|
-
- spec/models/array_spec.rb
|
341
|
-
- spec/models/ean13_spec.rb
|
342
|
-
- spec/models/inet_spec.rb
|
343
|
-
- spec/models/ranges/daterange_spec.rb
|
344
|
-
- spec/models/ranges/int4range_spec.rb
|
345
|
-
- spec/models/ranges/int8range_spec.rb
|
346
|
-
- spec/models/ranges/numrange_spec.rb
|
347
|
-
- spec/models/ranges/tsrange_spec.rb
|
348
|
-
- spec/models/ranges/tstzrange_spec.rb
|
349
280
|
- spec/queries/array_queries_spec.rb
|
350
281
|
- spec/queries/contains_querie_spec.rb
|
351
282
|
- spec/queries/sanity_spec.rb
|
352
|
-
- spec/schema_dumper/array_spec.rb
|
353
|
-
- spec/schema_dumper/cidr_spec.rb
|
354
|
-
- spec/schema_dumper/citext_spec.rb
|
355
|
-
- spec/schema_dumper/ean13_spec.rb
|
356
|
-
- spec/schema_dumper/extension_spec.rb
|
357
|
-
- spec/schema_dumper/index_spec.rb
|
358
|
-
- spec/schema_dumper/inet_spec.rb
|
359
|
-
- spec/schema_dumper/macaddr_spec.rb
|
360
|
-
- spec/schema_dumper/ranges/daterange_spec.rb
|
361
|
-
- spec/schema_dumper/ranges/int4range_spec.rb
|
362
|
-
- spec/schema_dumper/ranges/int8range_spec.rb
|
363
|
-
- spec/schema_dumper/ranges/numrange_spec.rb
|
364
|
-
- spec/schema_dumper/ranges/tsrange_spec.rb
|
365
|
-
- spec/schema_dumper/ranges/tstzrange_spec.rb
|
366
|
-
- spec/schema_dumper/uuid_spec.rb
|
367
283
|
- spec/spec_helper.rb
|
data/docs/indexes.md
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# Indexes
|
2
|
-
|
3
|
-
## Index types
|
4
|
-
|
5
|
-
Postgres\_ext allows you to specify index type and index operator
|
6
|
-
class at index creation.
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
add_index :table_name, :column, :using => :gin
|
10
|
-
add_index :table_name, :column, :using => :gin, :index_opclass => :gin_trgm_ops
|
11
|
-
```
|
12
|
-
|
13
|
-
## Where clauses
|
14
|
-
|
15
|
-
Postgres\_ext allows you to specify a where clause at index creation.
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
add_index :table_name, :column, :where => 'column < 50'
|
19
|
-
```
|
20
|
-
|
21
|
-
## Concurrent Indexes
|
22
|
-
|
23
|
-
Postgres\_ext allows you to create indexes concurrently using the
|
24
|
-
`:algorithm` option
|
25
|
-
|
26
|
-
```ruby
|
27
|
-
add_index :table_name, :column, :algorithm => :concurrently
|
28
|
-
```
|