schema_plus_pg_indexes 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/README.md +3 -3
- data/lib/schema_plus_pg_indexes.rb +0 -1
- data/lib/schema_plus_pg_indexes/active_record/connection_adapters/index_definition.rb +2 -2
- data/lib/schema_plus_pg_indexes/middleware/postgresql/migration.rb +13 -0
- data/lib/schema_plus_pg_indexes/version.rb +1 -1
- data/schema_plus_pg_indexes.gemspec +1 -1
- data/spec/deprecation_spec.rb +1 -1
- data/spec/schema_dumper_spec.rb +0 -8
- metadata +7 -2
- data/lib/schema_plus_pg_indexes/middleware/migration.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab9e97841907e541e956b5913588e9da67ac61a3
|
4
|
+
data.tar.gz: 24f847eed723f93c188de98e38bdf32380a1b681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b37d277f416c7bbbcafe1228cf0e96d8d7cc11f10d3e880076c587eef9a2d0d9e159091ed7d69f372bea5cc752d86e01796ea7019eabbc67c16ea27413c0f42
|
7
|
+
data.tar.gz: c162ca9beb5865f541193730ba48d1bb28566c8a874cbc45fe851b60ee4521d6e3f7c1488e9f7b0a6898669b8fc1fa88cb8ad04d223d4fd46ed13d97a77a5448
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -31,12 +31,12 @@ gem "schema_plus_pg_indexes"
|
|
31
31
|
|
32
32
|
schema_plus_pg_indexes is tested on
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
<!-- SCHEMA_DEV: MATRIX - begin -->
|
35
|
+
<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
|
36
36
|
* ruby **1.9.3** with rails **4.2**, using **postgresql**
|
37
37
|
* ruby **2.1.5** with rails **4.2**, using **postgresql**
|
38
38
|
|
39
|
-
|
39
|
+
<!-- SCHEMA_DEV: MATRIX - end -->
|
40
40
|
|
41
41
|
|
42
42
|
## History
|
@@ -2,7 +2,6 @@ require 'schema_monkey'
|
|
2
2
|
require 'schema_plus_indexes'
|
3
3
|
|
4
4
|
require_relative 'schema_plus_pg_indexes/active_record/connection_adapters/index_definition'
|
5
|
-
require_relative 'schema_plus_pg_indexes/middleware/migration'
|
6
5
|
require_relative 'schema_plus_pg_indexes/middleware/postgresql/dumper'
|
7
6
|
require_relative 'schema_plus_pg_indexes/middleware/postgresql/migration'
|
8
7
|
require_relative 'schema_plus_pg_indexes/middleware/postgresql/query'
|
@@ -23,8 +23,8 @@ module SchemaPlusPgIndexes
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def kind
|
26
|
-
ActiveSupport::Deprecation.warn "ActiveRecord IndexDefinition#kind is deprecated, used #using instead"
|
27
|
-
using
|
26
|
+
ActiveSupport::Deprecation.warn "ActiveRecord IndexDefinition#kind is deprecated, used #using.to_s instead"
|
27
|
+
using.to_s
|
28
28
|
end
|
29
29
|
|
30
30
|
def initialize_with_schema_plus_pg_indexes(*args)
|
@@ -3,9 +3,22 @@ module SchemaPlusPgIndexes
|
|
3
3
|
module Postgresql
|
4
4
|
module Migration
|
5
5
|
def self.insert
|
6
|
+
SchemaMonkey::Middleware::Migration::Index.prepend DeprecateArgs
|
6
7
|
SchemaMonkey::Middleware::Migration::IndexComponentsSql.append DefineExtensions
|
7
8
|
end
|
8
9
|
|
10
|
+
class DeprecateArgs < SchemaMonkey::Middleware::Base
|
11
|
+
def call(env)
|
12
|
+
{:conditions => :where, :kind => :using}.each do |deprecated, proper|
|
13
|
+
if env.options[deprecated]
|
14
|
+
ActiveSupport::Deprecation.warn "ActiveRecord index option #{deprecated.inspect} is deprecated, use #{proper.inspect} instead"
|
15
|
+
env.options[proper] = env.options.delete(deprecated)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
continue env
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
9
22
|
class DefineExtensions < SchemaMonkey::Middleware::Base
|
10
23
|
# SchemaPlusPgIndexes provides the following extra options for PostgreSQL
|
11
24
|
# indexes:
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.7"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0.0"
|
27
|
-
spec.add_development_dependency "schema_dev", "~> 2.0"
|
27
|
+
spec.add_development_dependency "schema_dev", "~> 2.0", ">= 2.0.3"
|
28
28
|
spec.add_development_dependency "simplecov"
|
29
29
|
spec.add_development_dependency "simplecov-gem-profile"
|
30
30
|
end
|
data/spec/deprecation_spec.rb
CHANGED
@@ -43,7 +43,7 @@ describe 'Deprecations' do
|
|
43
43
|
index = User.indexes.first
|
44
44
|
expect(ActiveSupport::Deprecation).to receive(:warn).with(/kind.*using/)
|
45
45
|
expect(index.using).to eq using # sanity check
|
46
|
-
expect(index.kind).to eq
|
46
|
+
expect(index.kind).to eq using.to_s
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
data/spec/schema_dumper_spec.rb
CHANGED
@@ -116,14 +116,6 @@ describe "Schema dump" do
|
|
116
116
|
expect(dump_posts).to match(/body.*index:.*using: :hash/)
|
117
117
|
end
|
118
118
|
end
|
119
|
-
|
120
|
-
it "should not include index order for non-ordered index types" do
|
121
|
-
with_index Post, :user_id, :using => :hash do
|
122
|
-
expect(dump_posts).to match(/user_id.*index:.*using: :hash/)
|
123
|
-
expect(dump_posts).not_to match(%r{order})
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
119
|
end
|
128
120
|
|
129
121
|
protected
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus_pg_indexes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
@@ -101,6 +101,9 @@ dependencies:
|
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '2.0'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 2.0.3
|
104
107
|
type: :development
|
105
108
|
prerelease: false
|
106
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -108,6 +111,9 @@ dependencies:
|
|
108
111
|
- - "~>"
|
109
112
|
- !ruby/object:Gem::Version
|
110
113
|
version: '2.0'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 2.0.3
|
111
117
|
- !ruby/object:Gem::Dependency
|
112
118
|
name: simplecov
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,7 +160,6 @@ files:
|
|
154
160
|
- gemfiles/rails-4.2/Gemfile.postgresql
|
155
161
|
- lib/schema_plus_pg_indexes.rb
|
156
162
|
- lib/schema_plus_pg_indexes/active_record/connection_adapters/index_definition.rb
|
157
|
-
- lib/schema_plus_pg_indexes/middleware/migration.rb
|
158
163
|
- lib/schema_plus_pg_indexes/middleware/postgresql/dumper.rb
|
159
164
|
- lib/schema_plus_pg_indexes/middleware/postgresql/migration.rb
|
160
165
|
- lib/schema_plus_pg_indexes/middleware/postgresql/query.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module SchemaPlusPgIndexes
|
2
|
-
module Middleware
|
3
|
-
module Migration
|
4
|
-
|
5
|
-
def self.insert
|
6
|
-
SchemaMonkey::Middleware::Migration::Index.prepend DeprecateArgs
|
7
|
-
end
|
8
|
-
|
9
|
-
class DeprecateArgs < SchemaMonkey::Middleware::Base
|
10
|
-
def call(env)
|
11
|
-
{:conditions => :where, :kind => :using}.each do |deprecated, proper|
|
12
|
-
if env.options[deprecated]
|
13
|
-
ActiveSupport::Deprecation.warn "ActiveRecord index option #{deprecated.inspect} is deprecated, use #{proper.inspect} instead"
|
14
|
-
env.options[proper] = env.options.delete(deprecated)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
continue env
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|