Class: Pilipinas::CodeIndexesGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pilipinas::CodeIndexesGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/pilipinas/code_indexes_generator.rb
Overview
Rails generator that adds unique indexes on the code column to all four pilipinas_* tables.
Run this if your database was created with an older version of the gem that did not include these indexes, and rake pilipinas:load raises:
ArgumentError: No unique index found for code
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(_dir) ⇒ String
31 32 33 |
# File 'lib/generators/pilipinas/code_indexes_generator.rb', line 31 def self.next_migration_number(_dir) Time.now.utc.strftime('%Y%m%d%H%M%S') end |
Instance Method Details
#generate_migration ⇒ Object
24 25 26 27 |
# File 'lib/generators/pilipinas/code_indexes_generator.rb', line 24 def generate_migration migration_template 'templates/add_pilipinas_code_indexes.rb', 'db/migrate/add_pilipinas_code_indexes.rb' end |