Sha256: 539174c8e053c3be6608da6fd68d07887686f0dddd14fa7f3afd10ba6091fa69

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require 'rails/generators/migration'

module MagicAddresses
  module Generators
    class UpdateGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "add magic_addresses update migrations"

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

      def copy_migrations
        ## copy update migration
        migration_template( "update_address_migration.rb", "db/migrate/update_magic_addresses.rb" )
        ## copy named_address migration
        migration_template( "add_named_addresses_migration.rb", "db/migrate/add_named_addresses.rb" )
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
magic_addresses-0.0.44 lib/generators/magic_addresses/update_generator.rb