Class: Sessions::Generators::UpgradeGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sessions::Generators::UpgradeGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/sessions/upgrade_generator.rb
Overview
‘rails generate sessions:upgrade` — copies version-to-version migrations for apps that installed a prior release. The install generator remains the source for fresh apps; this generator gives existing hosts an explicit, reviewable upgrade path.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dir) ⇒ Object
21 22 23 |
# File 'lib/generators/sessions/upgrade_generator.rb', line 21 def self.next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end |
Instance Method Details
#create_upgrade_migrations ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/generators/sessions/upgrade_generator.rb', line 25 def create_upgrade_migrations migration_template "add_adoption_key_to_sessions.rb.erb", File.join(db_migrate_path, "add_sessions_adoption_key_to_#{table_name}.rb") migration_template "add_app_build_to_sessions_events.rb.erb", File.join(db_migrate_path, "add_sessions_app_build_to_sessions_events.rb") migration_template "add_lifecycle_to_sessions.rb.erb", File.join(db_migrate_path, "add_sessions_lifecycle_to_#{table_name}.rb") end |
#display_post_upgrade_message ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/generators/sessions/upgrade_generator.rb', line 34 def say "\n🔐 sessions upgrade migrations have been installed.", :green say "\nTo complete the upgrade:" say " 1. Review the generated migration." say " 2. Run 'rails db:migrate'." say " ⚠️ Deploy the migrations before relying on lifecycle-row revocation, " \ "adoption hardening, or app-build event columns.", :yellow end |