Class: LazySusanGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LazySusanGenerator
- Defined in:
- lib/generators/lazy_susan_generator.rb
Constant Summary collapse
- DATABASE =
ActiveRecord::Base.connection
Instance Method Summary collapse
Instance Method Details
#generate_lazy_susan ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/lazy_susan_generator.rb', line 3 def generate_lazy_susan results = {} DATABASE.tables.each do |table_name| missing_indexes = gather_missing_indexes(table_name) results[table_name] = missing_indexes if missing_indexes.any? end if results.keys.any? generate_migration(results) else puts "No missing indexes found." end end |