aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-07-23 03:33:25 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2019-01-16 13:13:23 +0000
commit2bad3f46cdd8decee7d2d9b804ac7c75b5a1cc5d (patch)
tree364e5158279180a91c4a1fc9091ef7860cd7a687 /railties/lib/rails/generators
parentd67863af390b45ed8dde551071a29b3d347bb8be (diff)
downloadrails-2bad3f46cdd8decee7d2d9b804ac7c75b5a1cc5d.tar.gz
rails-2bad3f46cdd8decee7d2d9b804ac7c75b5a1cc5d.tar.bz2
rails-2bad3f46cdd8decee7d2d9b804ac7c75b5a1cc5d.zip
Add foreign key to active_storage_attachments for `blob_id` via new migration
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
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index e777590be8..5c59566dc2 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -306,6 +306,13 @@ module Rails
end
remove_task :update_bin_files
+ def update_active_storage
+ unless skip_active_storage?
+ rails_command "active_storage:update"
+ end
+ end
+ remove_task :update_active_storage
+
def create_config_files
build(:config)
end