Sha256: df47abf54dcbd15a8ae0ff787fb1e501c91b8353a64768a718252c158782194c

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

require 'rails/generators/active_record'

module ActiveRecord
  module Generators
    class RemoveGenerator < ActiveRecord::Generators::Base
      include Rails::Generators::Migration

      source_root File.expand_path('../templates', __FILE__)
      desc 'Creates a migration file to remove all traces of Merit on the DB'

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

      def copy_migrations_and_model
        migration_template 'remove_merit_tables.rb',
                           'db/migrate/remove_merit_tables.rb'

        migration_template(
          'remove_merit_fields_from_model.rb',
          "db/migrate/remove_merit_fields_from_#{table_name}.rb"
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
merit-3.0.0 lib/generators/active_record/remove_generator.rb
merit-2.4.0 lib/generators/active_record/remove_generator.rb
merit-2.3.4 lib/generators/active_record/remove_generator.rb
merit-2.3.3 lib/generators/active_record/remove_generator.rb