schema_plus_indexes 0.1.1 → 0.1.2
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/.travis.yml +0 -1
- data/Gemfile +2 -0
- data/README.md +43 -14
- data/gemfiles/Gemfile.base +0 -4
- data/lib/schema_plus_indexes.rb +3 -3
- data/lib/schema_plus_indexes/active_record/base.rb +1 -6
- data/lib/schema_plus_indexes/active_record/connection_adapters/abstract_adapter.rb +2 -6
- data/lib/schema_plus_indexes/active_record/connection_adapters/index_definition.rb +3 -6
- data/lib/schema_plus_indexes/middleware/{sqlite3.rb → schema.rb} +2 -2
- data/lib/schema_plus_indexes/version.rb +1 -1
- data/schema_dev.yml +0 -1
- data/schema_plus_indexes.gemspec +20 -20
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4aa8a0bb209b6aefdd7ae30e47ec26c594a6e3
|
4
|
+
data.tar.gz: 6deee591cfa43d5a6bb3a14f5a4048647b9c0a2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73655b914ee4ff00cdc004d605e843eaa9c88268073ae1658ed6b6df0153a8b3e969b48ecdd1595e0c66237afc1e58d10cb18e526de97850dc620627f24bf465
|
7
|
+
data.tar.gz: c8fe49bbd8130f7562ab10b4d3caff918e2d9efbd826f16ecec40789fb6d979c47a00824df0811d52756c414b171d0a43115a0d355d623f394860a2aaa776919
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# schema_plus_indexes
|
7
7
|
|
8
|
-
|
8
|
+
SchemaPlusIndexes adds various convenient capabilities to `ActiveRecord`'s index handling:
|
9
9
|
|
10
10
|
* Adds shorthands to the `:index` option in migrations
|
11
11
|
|
@@ -45,18 +45,31 @@ schema_plus_indexes is part of the [SchemaPlus](https://github.com/SchemaPlus/)
|
|
45
45
|
|
46
46
|
## Installation
|
47
47
|
|
48
|
-
|
48
|
+
<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - begin -->
|
49
|
+
<!-- These lines are auto-inserted from a schema_dev template -->
|
50
|
+
As usual:
|
49
51
|
|
50
52
|
```ruby
|
51
|
-
gem "schema_plus_indexes"
|
53
|
+
gem "schema_plus_indexes" # in a Gemfile
|
54
|
+
gem.add_dependency "schema_plus_indexes" # in a .gemspec
|
52
55
|
```
|
56
|
+
|
57
|
+
To use with a rails app, also include
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
gem "schema_monkey_rails"
|
61
|
+
```
|
62
|
+
|
63
|
+
which creates a Railtie to that will insert SchemaPlus::Indexes appropriately into the rails stack. To use with Padrino, see [schema_monkey_padrino](https://github.com/SchemaPlus/schema_monkey_padrino).
|
64
|
+
|
65
|
+
<!-- SCHEMA_DEV: TEMPLATE INSTALLATION - end -->
|
66
|
+
|
53
67
|
## Compatibility
|
54
68
|
|
55
69
|
schema_plus_indexes is tested on
|
56
70
|
|
57
71
|
<!-- SCHEMA_DEV: MATRIX - begin -->
|
58
72
|
<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
|
59
|
-
* ruby **1.9.3** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
|
60
73
|
* ruby **2.1.5** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
|
61
74
|
|
62
75
|
<!-- SCHEMA_DEV: MATRIX - end -->
|
@@ -74,8 +87,10 @@ the standard protocol: fork, feature branch, develop, push, and issue pull reque
|
|
74
87
|
|
75
88
|
Some things to know about to help you develop and test:
|
76
89
|
|
77
|
-
|
78
|
-
|
90
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - begin -->
|
91
|
+
<!-- These lines are auto-inserted from a schema_dev template -->
|
92
|
+
* **schema_dev**: SchemaPlus::Indexes uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
|
93
|
+
facilitate running rspec tests on the matrix of ruby, activerecord, and database
|
79
94
|
versions that the gem supports, both locally and on
|
80
95
|
[travis-ci](http://travis-ci.org/SchemaPlus/schema_plus_indexes)
|
81
96
|
|
@@ -84,15 +99,29 @@ Some things to know about to help you develop and test:
|
|
84
99
|
$ schema_dev bundle install
|
85
100
|
$ schema_dev rspec
|
86
101
|
|
87
|
-
You can also run on just one configuration at a time; For info, see `schema_dev --help` or the
|
88
|
-
[schema_dev](https://github.com/SchemaPlus/schema_dev) README.
|
102
|
+
You can also run on just one configuration at a time; For info, see `schema_dev --help` or the [schema_dev](https://github.com/SchemaPlus/schema_dev) README.
|
89
103
|
|
90
104
|
The matrix of configurations is specified in `schema_dev.yml` in
|
91
105
|
the project root.
|
92
106
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
107
|
+
|
108
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
|
109
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin -->
|
110
|
+
<!-- These lines are auto-inserted from a schema_dev template -->
|
111
|
+
* **schema_plus_core**: SchemaPlus::Indexes uses the SchemaPlus::Core API that
|
112
|
+
provides middleware callback stacks to make it easy to extend
|
113
|
+
ActiveRecord's behavior. If that API is missing something you need for
|
114
|
+
your contribution, please head over to
|
115
|
+
[schema_plus_core](https://github/SchemaPlus/schema_plus_core) and open
|
116
|
+
an issue or pull request.
|
117
|
+
|
118
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - end -->
|
119
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - begin -->
|
120
|
+
<!-- These lines are auto-inserted from a schema_dev template -->
|
121
|
+
* **schema_monkey**: SchemaPlus::Indexes is implemented as a
|
122
|
+
[schema_monkey](https://github.com/SchemaPlus/schema_monkey) client,
|
123
|
+
using [schema_monkey](https://github.com/SchemaPlus/schema_monkey)'s
|
124
|
+
convention-based protocols for extending ActiveRecord and using middleware stacks.
|
125
|
+
For more information see [schema_monkey](https://github.com/SchemaPlus/schema_monkey)'s README.
|
126
|
+
|
127
|
+
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_MONKEY - end -->
|
data/gemfiles/Gemfile.base
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec :path => File.expand_path('..', __FILE__)
|
3
3
|
|
4
|
-
platform :ruby do
|
5
|
-
gem "byebug" if RUBY_VERSION > "2"
|
6
|
-
end
|
7
|
-
|
8
4
|
File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
|
data/lib/schema_plus_indexes.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'schema_plus/core'
|
2
2
|
|
3
3
|
require_relative 'schema_plus_indexes/active_record/base'
|
4
4
|
require_relative 'schema_plus_indexes/active_record/connection_adapters/abstract_adapter'
|
@@ -6,6 +6,6 @@ require_relative 'schema_plus_indexes/active_record/connection_adapters/index_de
|
|
6
6
|
require_relative 'schema_plus_indexes/middleware/dumper'
|
7
7
|
require_relative 'schema_plus_indexes/middleware/migration'
|
8
8
|
require_relative 'schema_plus_indexes/middleware/model'
|
9
|
-
require_relative 'schema_plus_indexes/middleware/
|
9
|
+
require_relative 'schema_plus_indexes/middleware/schema'
|
10
10
|
|
11
|
-
SchemaMonkey.register
|
11
|
+
SchemaMonkey.register SchemaPlusIndexes
|
@@ -3,18 +3,14 @@ module SchemaPlusIndexes
|
|
3
3
|
module ConnectionAdapters
|
4
4
|
module AbstractAdapter
|
5
5
|
|
6
|
-
def self.included(base) #:nodoc:
|
7
|
-
base.alias_method_chain :remove_index, :schema_plus_indexes
|
8
|
-
end
|
9
|
-
|
10
6
|
# Extends rails' remove_index to include this options:
|
11
7
|
# :if_exists
|
12
|
-
def
|
8
|
+
def remove_index(table_name, *args)
|
13
9
|
options = args.extract_options!
|
14
10
|
if_exists = options.delete(:if_exists)
|
15
11
|
args << options if options.any?
|
16
12
|
return if if_exists and not index_name_exists?(table_name, options[:name] || index_name(table_name, *args), false)
|
17
|
-
|
13
|
+
super table_name, *args
|
18
14
|
end
|
19
15
|
|
20
16
|
end
|
@@ -6,17 +6,14 @@ module SchemaPlusIndexes
|
|
6
6
|
# about partial indexes and case sensitivity (i.e. Postgresql
|
7
7
|
# support).
|
8
8
|
module IndexDefinition
|
9
|
-
def self.included(base) #:nodoc:
|
10
|
-
base.alias_method_chain :initialize, :schema_plus_indexes
|
11
|
-
end
|
12
9
|
|
13
|
-
def
|
10
|
+
def initialize(*args) #:nodoc:
|
14
11
|
# same args as add_index(table_name, column_names, options)
|
15
12
|
if args.length == 3 and Hash === args.last
|
16
13
|
table_name, column_names, options = args + [{}]
|
17
|
-
|
14
|
+
super table_name, options[:name], options[:unique], column_names, options[:length], options[:orders], options[:where], options[:type], options[:using]
|
18
15
|
else # backwards compatibility
|
19
|
-
|
16
|
+
super
|
20
17
|
end
|
21
18
|
unless orders.blank?
|
22
19
|
# fill out orders with :asc when undefined. make sure hash ordering
|
data/schema_dev.yml
CHANGED
data/schema_plus_indexes.gemspec
CHANGED
@@ -3,27 +3,27 @@ lib = File.expand_path('../lib', __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'schema_plus_indexes/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "schema_plus_indexes"
|
8
|
+
gem.version = SchemaPlusIndexes::VERSION
|
9
|
+
gem.authors = ["ronen barzel"]
|
10
|
+
gem.email = ["ronen@barzel.org"]
|
11
|
+
gem.summary = %q{Adds shorthands and conveniences to ActiveRecord's handling of indexes}
|
12
|
+
gem.homepage = "https://github.com/SchemaPlus/schema_plus_indexes"
|
13
|
+
gem.license = "MIT"
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
gem.files = `git ls-files -z`.split("\x0")
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
gem.add_dependency "activerecord", "~> 4.2"
|
21
|
+
gem.add_dependency "schema_plus_core", "~> 0.1"
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
gem.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
gem.add_development_dependency "rake", "~> 10.0"
|
25
|
+
gem.add_development_dependency "rspec", "~> 3.0.0"
|
26
|
+
gem.add_development_dependency "schema_dev", "~> 3.1"
|
27
|
+
gem.add_development_dependency "simplecov"
|
28
|
+
gem.add_development_dependency "simplecov-gem-profile"
|
29
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -23,7 +23,7 @@ def define_schema(config={}, &block)
|
|
23
23
|
ActiveRecord::Migration.suppress_messages do
|
24
24
|
ActiveRecord::Schema.define do
|
25
25
|
connection.tables.each do |table|
|
26
|
-
drop_table table, :
|
26
|
+
drop_table table, :force => :cascade
|
27
27
|
end
|
28
28
|
instance_eval &block
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus_indexes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: schema_plus_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ files:
|
|
147
147
|
- lib/schema_plus_indexes/middleware/dumper.rb
|
148
148
|
- lib/schema_plus_indexes/middleware/migration.rb
|
149
149
|
- lib/schema_plus_indexes/middleware/model.rb
|
150
|
-
- lib/schema_plus_indexes/middleware/
|
150
|
+
- lib/schema_plus_indexes/middleware/schema.rb
|
151
151
|
- lib/schema_plus_indexes/version.rb
|
152
152
|
- schema_dev.yml
|
153
153
|
- schema_plus_indexes.gemspec
|