Sha256: 04908dc890136e017201ff7179af12e078326ac4c9b7cac4ef54c2e0530f3901

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require 'rails/generators/migration'

module RevelryContent
  module Generators
    class MigrationsGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "add the 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
        migration_template "create_revelry_content_contents.rb", "db/migrate/create_revelry_content_contents.rb"
        migration_template "create_versions.rb", "db/migrate/create_versions.rb"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
revelry_content-0.0.1.2 lib/generators/revelry_content/migrations_generator.rb