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 |
# 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") end |
#display_post_upgrade_message ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/generators/sessions/upgrade_generator.rb', line 30 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 migration before relying on adoption hardening.", :yellow end |