未验证 提交 9e34df00 编写于 作者: G George Claghorn 提交者: GitHub

Merge pull request #33419 from bogdanvlviv/update-active_storage

`rake app:update` should update active_storage
......@@ -135,6 +135,7 @@ Style/FrozenStringLiteralComment:
- 'actionpack/test/**/*.builder'
- 'actionpack/test/**/*.ruby'
- 'activestorage/db/migrate/**/*.rb'
- 'activestorage/db/update_migrate/**/*.rb'
- 'actionmailbox/db/migrate/**/*.rb'
- 'actiontext/db/migrate/**/*.rb'
......
......@@ -407,6 +407,10 @@ namespace :railties do
if railtie.respond_to?(:paths) && (path = railtie.paths["db/migrate"].first)
railties[railtie.railtie_name] = path
end
unless ENV["MIGRATIONS_PATH"].blank?
railties[railtie.railtie_name] = railtie.root + ENV["MIGRATIONS_PATH"]
end
end
on_skip = Proc.new do |name, migration|
......
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
unless foreign_key_exists?(:active_storage_attachments, column: :blob_id)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end
end
......@@ -12,4 +12,11 @@ namespace :active_storage do
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
......@@ -305,6 +305,13 @@ def update_bin_files
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
......
......@@ -2,7 +2,7 @@
namespace :app do
desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
task update: [ "update:configs", "update:bin", "update:upgrade_guide_info" ]
task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
task template: :environment do
......@@ -51,6 +51,10 @@ namespace :app do
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
end
task :active_storage do
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
end
task :upgrade_guide_info do
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册