arel-mysql-index-hint 0.1.2 → 0.1.3
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/README.md +7 -3
- data/arel-mysql-index-hint.gemspec +1 -1
- data/lib/arel-mysql-index-hint/active_record-hint_methods.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e433fd8290f9349c0e86772ece267aa611800ccc
|
4
|
+
data.tar.gz: a83ef70e8c11b80ce7abc94167ac69dbc9fcfa12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a380d743800bbf28a6046d3e1c30b83100c279ce2d2b98dcf928ac1886db880b403703951aff81becea95cdfa8c4bfb3937f9b12c1a5d7afaee48ef49e8de64
|
7
|
+
data.tar.gz: 68fa23137460618b48075bb2056ec01bea2c28da9408512c8e2f0ccc45bb649f2954a3ce0a28cf1367c74cb05a07e4d74f80e88b7696c15fa70f684a08aabc1f
|
data/README.md
CHANGED
@@ -26,11 +26,15 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
Article.hint(idx_article: :force)
|
29
|
-
|
29
|
+
#=> "SELECT `articles`.* FROM `articles` FORCE INDEX (`idx_article`)"
|
30
30
|
|
31
31
|
Article.joins(:comments).hint(articles: {idx_article: :use})
|
32
|
-
|
32
|
+
#=> "SELECT `articles`.* FROM `articles` USE INDEX (`idx_article`) INNER JOIN `comments` ON `comments`
|
33
33
|
|
34
34
|
Article.joins(:comments).hint(comments: {idx_comment: :force})
|
35
|
-
|
35
|
+
#=> "SELECT `articles`.* FROM `articles` INNER JOIN `comments` FORCE INDEX (`idx_comment`) ON `comments"
|
36
36
|
```
|
37
|
+
|
38
|
+
## Related Links
|
39
|
+
|
40
|
+
* [MySQL::MySQL 5.6 Reference Manual::13.2.9.3 Index Hint Syntax](https://dev.mysql.com/doc/refman/5.6/en/index-hints.html)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "arel-mysql-index-hint"
|
4
|
-
spec.version = "0.1.
|
4
|
+
spec.version = "0.1.3"
|
5
5
|
spec.authors = ["Genki Sugawara"]
|
6
6
|
spec.email = ["sgwr_dts@yahoo.co.jp"]
|
7
7
|
spec.summary = %q{Add index hint to MySQL query in Arel.}
|
@@ -11,10 +11,11 @@ module ArelMysqlIndexHint
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def mysql_index_hint_value
|
14
|
-
@values[:mysql_index_hint]
|
14
|
+
@values[:mysql_index_hint]
|
15
15
|
end
|
16
16
|
|
17
17
|
def hint(index_hint_by_table)
|
18
|
+
self.mysql_index_hint_value ||= {}.with_indifferent_access
|
18
19
|
mysql_index_hint_value.update(index_hint_by_table)
|
19
20
|
self
|
20
21
|
end
|