Add multiple database support to post_migration generator

parent eb78edda
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/active_record'
require 'rails/generators/active_record/migration/migration_generator'
module PostDeploymentMigration
class PostDeploymentMigrationGenerator < Rails::Generators::NamedBase
def create_migration_file
timestamp = Time.now.utc.strftime('%Y%m%d%H%M%S')
template "migration.rb", "db/post_migrate/#{timestamp}_#{file_name}.rb"
end
def migration_class_name
file_name.camelize
class PostDeploymentMigrationGenerator < ActiveRecord::Generators::MigrationGenerator
def db_migrate_path
super.sub("migrate", "post_migrate")
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment