Sha256: 22a0edff932ad521af79574a0212084bf735451c497110de5727fe38a27da79b

Contents?: true

Size: 668 Bytes

Versions: 3

Compression:

Stored size: 668 Bytes

Contents

require 'rails/generators'
require 'rails/generators/active_record'
require 'rails/generators/actions/create_migration'

class DataMigrationGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../../templates', __FILE__)
  include Rails::Generators::Migration

  def create_data_migration
    migration_template('data_migration_template.rb', "db/migrate_data/#{file_name}.rb")
  end

  private

  def self.next_migration_number(dirname)
    ActiveRecord::Generators::Base.next_migration_number(dirname)
  end

  def migration_class_name
    @name.camelize
  end

  def migration_version
    return unless Rails.version >= '5'
    ['4.2']
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
createk_data_migrator-0.2.0 lib/generators/data_migration_generator.rb
createk_data_migrator-0.1.2 lib/generators/data_migration_generator.rb
createk_data_migrator-0.1.1 lib/generators/data_migration_generator.rb