Sha256: 5216b468b719a0aea523cde286d7be8f92c1500fc0e438971a92bbaab78c5bd7

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 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

      def migration_version
        "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
merit-3.0.3 lib/generators/active_record/remove_generator.rb
merit-3.0.2 lib/generators/active_record/remove_generator.rb
merit-3.0.1 lib/generators/active_record/remove_generator.rb