activerecord-simple_index_name 0.1.0.beta1 → 0.1.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/CHANGELOG.md +5 -0
- data/README.md +26 -5
- data/lib/activerecord/simple_index_name/railtie.rb +4 -2
- data/lib/activerecord/simple_index_name/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fa6b9aae3727e763a002f35d1ce57aad24114fa
|
4
|
+
data.tar.gz: eb91da3010ce3ae2e2ca0054706da0c16d9917d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a8931aae60ddc11a440ab53c811a4d57a779c893af7902475190a0234b2fa658a8b5a3defac05e19e128509ee1368ff5287fee49ce1f19c0186b39b633bb936
|
7
|
+
data.tar.gz: ec67d7146748d7243b38c26b128cfd82a00ce24fe4ebcb59d494f92bbd1908edc6809fcd133c74b6499b2ad912f420a2b5ad585c5bba57e0d6cd6912cb039054
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
# Activerecord::SimpleIndexName
|
2
2
|
|
3
|
-
|
3
|
+
Shorten index name
|
4
4
|
|
5
|
+
[](https://badge.fury.io/rb/activerecord-simple_index_name)
|
5
6
|
[](https://travis-ci.org/sue445/activerecord-simple_index_name)
|
6
7
|
[](https://gemnasium.com/sue445/activerecord-simple_index_name)
|
7
8
|
[](https://coveralls.io/github/sue445/activerecord-simple_index_name?branch=master)
|
8
9
|
[](https://codeclimate.com/github/sue445/activerecord-simple_index_name)
|
9
|
-
[](https://codeclimate.com/github/sue445/activerecord-simple_index_name)
|
10
10
|
|
11
|
-
|
11
|
+
## Supported
|
12
|
+
* [Ruby on Rails](https://github.com/rails/rails)
|
13
|
+
* [Padrino](https://github.com/padrino/padrino-framework)
|
14
|
+
* or plain activerecord
|
12
15
|
|
13
16
|
## Installation
|
14
17
|
|
@@ -28,7 +31,21 @@ Or install it yourself as:
|
|
28
31
|
|
29
32
|
## Usage
|
30
33
|
|
31
|
-
|
34
|
+
When run `rake db:migrate` (or `rake ar:migrate`), index name will be automatically short.
|
35
|
+
|
36
|
+
## Example
|
37
|
+
```ruby
|
38
|
+
create_table :user_stocks do |t|
|
39
|
+
t.integer :user_id, null: false
|
40
|
+
t.integer :article_id, null: false
|
41
|
+
t.timestamps null: false
|
42
|
+
end
|
43
|
+
|
44
|
+
add_index :user_stocks, [:user_id, :article_id]
|
45
|
+
```
|
46
|
+
|
47
|
+
* Index name without `activerecord-simple_index_name` : `index_user_stocks_on_user_id_and_article_id`
|
48
|
+
* Index name with `activerecord-simple_index_name` : `user_id_and_article_id`
|
32
49
|
|
33
50
|
## Development
|
34
51
|
|
@@ -38,10 +55,14 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
38
55
|
|
39
56
|
## Contributing
|
40
57
|
|
41
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
58
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/activerecord-simple_index_name.
|
42
59
|
|
43
60
|
|
44
61
|
## License
|
45
62
|
|
46
63
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
64
|
|
65
|
+
## Special thanks
|
66
|
+
[@kamipo](https://github.com/kamipo) :bow:
|
67
|
+
|
68
|
+
Original idea is http://qiita.com/kamipo/items/6e5a1e238d7cc0611ade (ja)
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Activerecord
|
2
2
|
module SimpleIndexName
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
|
-
|
5
|
-
|
4
|
+
initializer "simple_index_name.initializer" do
|
5
|
+
ActiveSupport.on_load(:active_record) do
|
6
|
+
require "activerecord/simple_index_name/active_record_ext"
|
7
|
+
end
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-simple_index_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- ".gitignore"
|
134
134
|
- ".rspec"
|
135
135
|
- ".travis.yml"
|
136
|
+
- CHANGELOG.md
|
136
137
|
- Gemfile
|
137
138
|
- LICENSE.txt
|
138
139
|
- README.md
|
@@ -162,9 +163,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
163
|
version: '0'
|
163
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
165
|
requirements:
|
165
|
-
- - "
|
166
|
+
- - ">="
|
166
167
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
168
|
+
version: '0'
|
168
169
|
requirements: []
|
169
170
|
rubyforge_project:
|
170
171
|
rubygems_version: 2.4.5.1
|