Class: RailsPulse::Generators::UpgradeGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration, BaseMethods
Defined in:
lib/generators/rails_pulse/upgrade_generator.rb

Constant Summary

Constants included from BaseMethods

BaseMethods::RAILS_PULSE_TABLES

Instance Method Summary collapse

Methods included from BaseMethods

included

Instance Method Details

#check_current_installationObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/rails_pulse/upgrade_generator.rb', line 17

def check_current_installation
  @database_type = detect_database_setup

  say "Detected database setup: #{@database_type}", :green

  case @database_type
  when :single
    upgrade_installation(migration_dir: "db/migrate", next_steps: single_db_next_steps)
  when :separate
    upgrade_installation(migration_dir: "db/rails_pulse_migrate", next_steps: separate_db_next_steps)
  when :schema_only
    offer_conversion_to_migrations
  when :not_installed
    say "Rails Pulse not detected. Run 'rails generate rails_pulse:install' first.", :red
    exit 1
  end
end