Class: Pgbus::Generators::MigrateJobLocksGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration, MigrationPath
Defined in:
lib/generators/pgbus/migrate_job_locks_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



22
23
24
25
# File 'lib/generators/pgbus/migrate_job_locks_generator.rb', line 22

def create_migration_file
  migration_template "migrate_job_locks_to_uniqueness_keys.rb.erb",
                     File.join(pgbus_migrate_path, "migrate_pgbus_job_locks_to_uniqueness_keys.rb")
end

#display_post_installObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/pgbus/migrate_job_locks_generator.rb', line 27

def display_post_install
  say ""
  say "Pgbus uniqueness keys migration created!", :green
  say ""
  say "This migration will:"
  say "  1. Create the new pgbus_uniqueness_keys table (3 columns, 1 index)"
  say "  2. Migrate existing locks from pgbus_job_locks"
  say "  3. Drop the old pgbus_job_locks table (8 columns, 3 indexes)"
  say ""
  say "Next steps:"
  say "  1. Run: rails db:migrate#{":#{options[:database]}" if separate_database?}"
  say "  2. Restart pgbus: bin/pgbus start"
  say ""
end