class GoodJob::UpdateGenerator
Rails generator used for updating GoodJob
in a Rails application. Run it with +bin/rails g good_job:update+ in your console.
Constants
- TEMPLATES
Public Instance Methods
update_migration_files()
click to toggle source
Generates incremental migration files unless they already exist. All migrations should be idempotent e.g. add_index
is guarded with if_index_exists?
# File lib/generators/good_job/update_generator.rb 20 def update_migration_files 21 migration_templates = Dir.children(File.join(TEMPLATES, 'migrations')).sort 22 migration_templates.each do |template_file| 23 destination_file = template_file.match(/^\d*_(.*\.rb)/)[1] # 01_create_good_jobs.rb.erb => create_good_jobs.rb 24 migration_template "migrations/#{template_file}", File.join(db_migrate_path, destination_file), skip: true 25 end 26 end