Class: HumanDomain::Generate::MigrationsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- HumanDomain::Generate::MigrationsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/human_domain/generate/migrations_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/human_domain/generate/migrations_generator.rb', line 14 def next_migration_number(dirname) = current_migration_number(dirname) if ActiveRecord::Base. = Time.new.utc.strftime("%Y%m%d%H%M%S") # Check if timestamp is the same with previous migration # due to fast generation in the same second if == .to_s "%.3d" % ( + 1) else end else "%.3d" % ( + 1) end end |
Instance Method Details
#create_migration_files ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/generators/human_domain/generate/migrations_generator.rb', line 33 def create_migration_files source_dir = 'db/migrate/human_domain' destination_dir = 'db/migrate' migration_template( "#{source_dir}/0001_create_blood_classification_systems.rb", "#{destination_dir}/create_blood_classification_systems.rb" ) migration_template( "#{source_dir}/0002_create_blood_group_names.rb", "#{destination_dir}/create_blood_group_names.rb" ) end |