Method: RpushMigrationGenerator.next_migration_number

Defined in:
lib/generators/rpush_migration_generator.rb

.next_migration_number(path) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/generators/rpush_migration_generator.rb', line 8

def next_migration_number(path)
  return new_migration_number unless next_template

  if existing_migration = migration_exists?(File.expand_path('db/migrate'), next_template)
    return File.basename(existing_migration).scan(/(\d+)_/).flatten.first
  end

  new_migration_number
end