Sha256: 8f1eb866fdfb0795279e327b9c58dc6b9ce171674e9920f48ca1b169be94eaed

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

require 'rails/generators/migration'

module TkhAdminPanel
  module Generators
    class CreateOrUpdateMigrationsGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "create or update setting 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
        puts 'creating or updating setting migrations'
        migration_template "create_settings.rb", "db/migrate/create_settings.rb"
        migration_template "add_contact_email_to_settings.rb", "db/migrate/add_contact_email_to_settings.rb"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tkh_admin_panel-0.10 lib/generators/tkh_admin_panel/create_or_update_migrations/create_or_update_migrations_generator.rb