Sha256: bd1a0bb582274fa0aaf9df807b205bfe6cc62f25cb7b9ef7f80ef7f5aa2e5c63

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

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"
        puts 'Creating the headers table'
        migration_template "create_headers.rb", "db/migrate/create_headers.rb"
      end
 
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tkh_illustrations-0.9.3 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.9.2 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.9.1 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.2.5 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.9 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.2.4 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.2.3 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.2 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
tkh_illustrations-0.1 lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb