mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
2bad3f46cd
We need this in order to be able to add this migration for users that use ActiveStorage during update their apps from Rails 5.2 to Rails 6.0. Related to #33405 `rake app:update` should update active_storage `rake app:update` should execute `rake active_storage:update` if it is used in the app that is being updated. It will add new active_storage's migrations to users' apps during update Rails. Context https://github.com/rails/rails/pull/33405#discussion_r204239399 Also, see a related discussion in the Campfire: https://3.basecamp.com/3076981/buckets/24956/chats/12416418@1236713081
22 lines
695 B
Ruby
22 lines
695 B
Ruby
# frozen_string_literal: true
|
|
|
|
namespace :active_storage do
|
|
# Prevent migration installation task from showing up twice.
|
|
Rake::Task["install:migrations"].clear_comments
|
|
|
|
desc "Copy over the migration needed to the application"
|
|
task install: :environment do
|
|
if Rake::Task.task_defined?("active_storage:install:migrations")
|
|
Rake::Task["active_storage:install:migrations"].invoke
|
|
else
|
|
Rake::Task["app:active_storage:install:migrations"].invoke
|
|
end
|
|
end
|
|
|
|
# desc "Copy over the migrations needed to the application upgrading"
|
|
task update: :environment do
|
|
ENV["MIGRATIONS_PATH"] = "db/update_migrate"
|
|
|
|
Rake::Task["active_storage:install"].invoke
|
|
end
|
|
end
|