Sha256: f7f4af72458c8f6bd043748679466b44b0243c72c7c2a2ec0e49762aa997403e

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

require 'rails/generators/migration'
 
module TkhIllustrations
  module Generators
    class CreateMigrationGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "add the migration"
      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
        puts 'creating illustration migration'
        migration_template "create_illustrations.rb", "db/migrate/create_illustrations.rb"
      end
 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tkh_illustrations-0.0.6 lib/generators/tkh_illustrations/create_migration/create_migration_generator.rb