Class: Rails::Generators::DataMigrationGenerator

Inherits:
NamedBase
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/rails/data_migration/data_migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(_) ⇒ Object



12
13
14
15
16
# File 'lib/generators/rails/data_migration/data_migration_generator.rb', line 12

def self.next_migration_number(_)
  ActiveRecord::Generators::Base.next_migration_number(
    MonarchMigrate.data_migrations_path
  )
end

Instance Method Details

#create_data_migrationObject



18
19
20
21
22
23
24
25
# File 'lib/generators/rails/data_migration/data_migration_generator.rb', line 18

def create_data_migration
  validate_file_name!

  migration_template(
    "data_migration.rb.erb",
    File.join(MonarchMigrate.migrator.path, "#{file_name}.rb")
  )
end