activerecord-simple_index_name 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5412bd44c0b4a17c660f20a255dd656a8e970b81
|
4
|
+
data.tar.gz: e119ded4b9fad17d946444b90dbd409918dcd565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906df279e7e6fa1742079b7ec77405659196ee1e39d858cbc975cf399284137ba2dd2262b61815f2f0e09d99f158cd2baa1e2a9fff041643b4bb9b8e9f318172
|
7
|
+
data.tar.gz: 78de265222ea539acab0889cb8ddb142cc4841bd0afcf52d7f28d3ee1bb90c67a46110d0e1657f0792e3612687dbcb7b13d72270305d1355ceb3baa76e653e7c
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
## Unreleased
|
4
|
-
[full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v0.
|
4
|
+
[full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v0.4.0...master)
|
5
|
+
|
6
|
+
## v0.4.0
|
7
|
+
[full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v0.3.0...v0.4.0)
|
8
|
+
|
9
|
+
* Support `rename_table`
|
10
|
+
* https://github.com/sue445/activerecord-simple_index_name/issues/32
|
11
|
+
* https://github.com/sue445/activerecord-simple_index_name/pull/33
|
5
12
|
|
6
13
|
## v0.3.0
|
7
14
|
[full changelog](http://github.com/sue445/activerecord-simple_index_name/compare/v0.3.0.beta1...v0.3.0)
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "activerecord"
|
23
23
|
spec.add_dependency "activesupport"
|
24
24
|
|
25
|
+
spec.add_development_dependency "activerecord-compatible_legacy_migration"
|
25
26
|
spec.add_development_dependency "bundler"
|
26
27
|
spec.add_development_dependency "coveralls"
|
27
28
|
spec.add_development_dependency "codeclimate-test-reporter"
|
@@ -21,6 +21,17 @@ module ActiveRecord
|
|
21
21
|
ensure
|
22
22
|
Thread.current[:simple_index_name_shorten_mode] = nil
|
23
23
|
end
|
24
|
+
|
25
|
+
def self.current_shorten?
|
26
|
+
case Thread.current[:simple_index_name_shorten_mode]
|
27
|
+
when :enable
|
28
|
+
true
|
29
|
+
when :disable
|
30
|
+
false
|
31
|
+
else
|
32
|
+
config.auto_shorten
|
33
|
+
end
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
26
37
|
|
@@ -2,22 +2,20 @@ module ActiveRecord
|
|
2
2
|
module SimpleIndexName
|
3
3
|
module ActiveRecordExt
|
4
4
|
def index_name(table_name, options)
|
5
|
-
|
6
|
-
case Thread.current[:simple_index_name_shorten_mode]
|
7
|
-
when :enable
|
8
|
-
true
|
9
|
-
when :disable
|
10
|
-
false
|
11
|
-
else
|
12
|
-
ActiveRecord::SimpleIndexName.config.auto_shorten
|
13
|
-
end
|
14
|
-
|
15
|
-
if shorten_mode && Hash === options && options[:column]
|
5
|
+
if ActiveRecord::SimpleIndexName.current_shorten? && Hash === options && options[:column]
|
16
6
|
Array.wrap(options[:column]) * "_and_"
|
17
7
|
else
|
18
8
|
super
|
19
9
|
end
|
20
10
|
end
|
11
|
+
|
12
|
+
def rename_index(table_name, old_name, new_name)
|
13
|
+
if ActiveRecord::SimpleIndexName.current_shorten? && old_name == new_name
|
14
|
+
# nop
|
15
|
+
else
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-simple_index_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord-compatible_legacy_migration
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|