post_deployment_migration_generator.rb 391 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. require 'rails/generators'
  3. module Rails
  4. class PostDeploymentMigrationGenerator < Rails::Generators::NamedBase
  5. def create_migration_file
  6. timestamp = Time.zone.now.strftime('%Y%m%d%H%M%S')
  7. template 'migration.rb', "db/post_migrate/#{timestamp}_#{file_name}.rb"
  8. end
  9. def migration_class_name
  10. file_name.camelize
  11. end
  12. end
  13. end