mysql_double_index 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9be150c8a42ecd1d0811cff3b08d04c8b9b2030d
4
- data.tar.gz: 0f6c6723de490acefc1bf95fd8a15015db68c03c
3
+ metadata.gz: dfb6dcc0d17b8330f2f7b23714c636e5881f0e06
4
+ data.tar.gz: 0dd7f16d95d80c67eec39c0b4493edb3f2e93002
5
5
  SHA512:
6
- metadata.gz: b13ed17e507f6415781657b4d12121a354d3bcd086a039466f614e2b4f8c2194cf1d5bd0557afcfb8700e3c0301c8e957908a2491f89b594fa1b27d6b2837ee1
7
- data.tar.gz: ed820770082696ee8cb0665005665293ed79b2d074db45df58e7bfee7b04b7cb50a5bb839840b43d8aeced0b4d69ea644605e5002e0038ac671193649bb921a2
6
+ metadata.gz: 8a989de740c4fdd616a0cb13deb9c2094cfdcd939a2ae881b93651b1bf16d0929e9f97630fdba0effa08ebe334d234f70c4350bffaf3b2625d457c2ef7be31d4
7
+ data.tar.gz: 9809c7d374cff111a676a8df4ff9f72cba534369d0a97f8d40f8bdd27d9163c038b00093a8b17523297c4ffb9aa2c1841b3c6e79f9018d584060a0e2b8b2ba18
@@ -10,14 +10,19 @@ module MysqlDoubleIndex
10
10
  def test
11
11
  end
12
12
 
13
- def db_double_index
13
+ def db_double_index(table = nil)
14
14
  begin
15
15
  MysqlDoubleIndex.db_connection #连接数据库
16
16
  result = {}
17
17
  double_index = []
18
18
  redundancy_index = []
19
- sql="show tables"
20
- tables=ActiveRecord::Base.connection.execute(sql)
19
+ if table.nil?
20
+ sql="show tables"
21
+ tables=ActiveRecord::Base.connection.execute(sql)
22
+ else
23
+ tables = []
24
+ tables << [table]
25
+ end
21
26
  tables.each do |item|
22
27
  tmp_hash = {}
23
28
  keys = ActiveRecord::Base.connection.execute("show index from #{item[0]}")
@@ -56,14 +61,14 @@ module MysqlDoubleIndex
56
61
  print_arr << [item]
57
62
  end
58
63
  table = Terminal::Table.new :rows => print_arr
59
- puts table
64
+ puts table if double_index.size > 0
60
65
  print_arr = []
61
66
  print_arr << ["冗余索引"]
62
67
  redundancy_index.each do |item|
63
68
  print_arr << [item]
64
69
  end
65
70
  table = Terminal::Table.new :rows => print_arr
66
- puts table
71
+ puts table if redundancy_index.size > 0
67
72
  rescue Exception => e
68
73
  puts e.backtrace
69
74
  ensure
@@ -1,3 +1,3 @@
1
1
  module MysqlDoubleIndex
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_double_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sunyafei