Module: JobPacks::Generators::Migration

Included in:
InstallGenerator
Defined in:
lib/generators/job_packs/migration.rb

Instance Method Summary collapse

Instance Method Details

#next_migration_number(dirname) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
# File 'lib/generators/job_packs/migration.rb', line 4

def next_migration_number(dirname) #:nodoc:
  next_migration_number = current_migration_number(dirname) + 1
  if ::ActiveRecord::Base.timestamped_migrations
    [Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
  else
    format('%.3d', next_migration_number)
  end
end