lib/generators/scrivito/migration/migration_generator.rb in scrivito_sdk-0.30.0.rc1 vs lib/generators/scrivito/migration/migration_generator.rb in scrivito_sdk-0.30.0

- old
+ new

@@ -1,16 +1,18 @@ module Scrivito - class MigrationGenerator < ::Rails::Generators::NamedBase - include ::Rails::Generators::Migration + module Generators + class MigrationGenerator < ::Rails::Generators::NamedBase + include ::Rails::Generators::Migration - source_root File.expand_path('../templates', __FILE__) + source_root File.expand_path('../templates', __FILE__) - def self.next_migration_number(dirname) - Time.now.utc.strftime('%Y%m%d%H%M%S') - end + def self.next_migration_number(dirname) + Scrivito::Migration.next_migration_number(current_migration_number(dirname)) + end - def create_migration_file - base_path = Scrivito::Configuration.migration_path - migration_template('migration.erb', File.join(base_path, "#{file_name}.rb")) + def generate_migration + migration_template 'migration.erb', + File.join(Scrivito::Configuration.migration_path, "#{file_name}_migration.rb") + end end end end