Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy new migrations as part of the update task #4957

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/lib/generators/solidus/update/update_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Solidus
class UpdateGenerator < ::Rails::Generators::Base
FROM = Spree.previous_solidus_minor_version

desc 'Generates a new initializer to preview the new defaults for current Solidus version'
desc 'Generates a new initializer to preview the new defaults for current Solidus version and copy new migrations'

source_root File.expand_path('templates', __dir__)

Expand Down Expand Up @@ -40,7 +40,7 @@ class UpdateGenerator < ::Rails::Generators::Base
def create_new_defaults_initializer
previous_version_prompt = options[:previous_version_prompt]
return if previous_version_prompt && !yes?(<<~MSG, :red)
The update process is only supported if you are coming from version #{FROM}. If this is not the case, please, skip it and update your application to use Solidus #{FROM} before retrying.
The default preferences update process is only supported if you are coming from version #{FROM}. If this is not the case, please, skip it and update your application to use Solidus #{FROM} before retrying.
If you are confident you want to upgrade from a previous version, you must rerun the generator with the "--from={OLD_VERSION}" argument.
Are you sure you want to continue? (y/N)
MSG
Expand All @@ -57,6 +57,11 @@ def create_new_defaults_initializer
File.join(options[:initializer_directory], "#{options[:initializer_basename]}.rb")
end

def install_migrations
say_status :copying, "migrations"
rake 'spree:install:migrations'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using spree: as the namespace is even better than using the FROM env variable 👏 👏

end

def print_message
say <<~MSG

Expand Down