findex 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/findex/tasks.rb +5 -21
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/lib/findex/tasks.rb CHANGED
@@ -5,7 +5,7 @@ require 'rake/tasklib'
5
5
  namespace :db do
6
6
  desc 'Finds indexes your application probably needs'
7
7
  task :indexes => [:environment, :prepare] do
8
- indices = @findex.get_indices(:geo, [:name, [:id, :type]], :primary, :reflection, [:type, [:boolean, :date, :datetime, :time]])
8
+ indices = @findex.get_indices(:geo, [:name, [:id, :type]], :reflection, [:type, [:boolean, :date, :datetime, :time]])
9
9
  @findex.send_indices(indices)
10
10
  end
11
11
 
@@ -49,7 +49,7 @@ namespace :db do
49
49
  puts ' `rake db:indexes migration=true`'
50
50
  puts ''
51
51
  puts ' You can also target specific column types, like so:'
52
- [:boolean, :datetime, :geo, :primary, :relationships].each do |type|
52
+ [:boolean, :datetime, :geo, :relationships].each do |type|
53
53
  puts " `rake db:indexes:#{type}`"
54
54
  end
55
55
  puts ''
@@ -64,7 +64,7 @@ namespace :db do
64
64
  task :migration => :environment do
65
65
  @findex.generate_migration = true
66
66
  @findex.perform_index = false
67
- indices = @findex.get_indices(:geo, [:name, [:id, :type]], :primary, :reflection, [:type, [:boolean, :date, :datetime, :time]])
67
+ indices = @findex.get_indices(:geo, [:name, [:id, :type]], :reflection, [:type, [:boolean, :date, :datetime, :time]])
68
68
  @findex.send_indices(indices)
69
69
  end
70
70
 
@@ -85,16 +85,10 @@ namespace :db do
85
85
  task :perform => :environment do
86
86
  @findex.generate_migration = false
87
87
  @findex.perform_index = true
88
- indices = @findex.get_indices(:geo, [:name, [:id, :type]], :primary, :reflection, [:type, [:boolean, :date, :datetime, :time]])
88
+ indices = @findex.get_indices(:geo, [:name, [:id, :type]], :reflection, [:type, [:boolean, :date, :datetime, :time]])
89
89
  @findex.send_indices(indices)
90
90
  end
91
91
 
92
- desc 'Finds unindexed primary keys'
93
- task :primary => [:environment, :prepare] do
94
- @findex.migration_name = 'primary'
95
- @findex.send_indices(@findex.get_indices(:primary))
96
- end
97
-
98
92
  desc 'Finds unindexed relationship foreign keys'
99
93
  task :relationships => [:environment, :prepare] do
100
94
  @findex.migration_name = 'relationship'
@@ -173,16 +167,6 @@ class Findex
173
167
  indices
174
168
  end
175
169
 
176
- def get_model_primary_indices(model, indices, existing_indices)
177
- indices[model.table_name] ||= []
178
- parse_columns(model) do |column, column_name|
179
- if column.primary && check_index(column_name, indices[model.table_name], existing_indices)
180
- indices[model.table_name].push(column_name)
181
- end
182
- end
183
- indices
184
- end
185
-
186
170
  def get_model_reflection_indices(model, indices, existing_indices)
187
171
  indices[model.table_name] ||= []
188
172
  model.reflections.each do |name, reflection|
@@ -214,7 +198,7 @@ class Findex
214
198
  end
215
199
 
216
200
  def parse_columns(model)
217
- model.columns.each{|column| yield(column, column.name.to_sym)} if block_given?
201
+ model.columns.reject(&:primary).each{|column| yield(column, column.name.to_sym)} if block_given?
218
202
  end
219
203
 
220
204
  def send_indices(indices)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: findex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flip Sasser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-26 00:00:00 -05:00
12
+ date: 2010-03-05 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15