Sha256: 4353e4ba2df11ae7d0d10665c5f80b4e65a4c690235896e3cb4909f7bfdfb62d

Contents?: true

Size: 948 Bytes

Versions: 4

Compression:

Stored size: 948 Bytes

Contents

require 'rails/generators/migration'
 
module TkhIllustrations
  module Generators
    class CreateOrUpdateMigrationsGenerator < ::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 create_or_update_migrations
        puts 'Creating the illustrations table'
        migration_template "create_illustrations.rb", "db/migrate/create_illustrations.rb"
        puts 'Adding translation of name attribute for Globalize3'
        migration_template "add_translation_of_name_to_illustrations.rb", "db/migrate/add_translation_of_name_to_illustrations.rb"
      end
 
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tkh_illustrations-0.0.10 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.0.9 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.0.8 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.0.7 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb