Commit 3d9e875c authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '340083-add-multiple-database-support-to-post-migration-generator' into 'master'

Add multiple database support to post_migration generator

See merge request gitlab-org/gitlab!72819
parents eb1e3ff8 ab7edd4e
# 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