diff options
author | George Claghorn <george.claghorn@gmail.com> | 2019-01-16 17:04:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-16 17:04:47 -0600 |
commit | 9e34df00039d63b5672315419e76f06f80ef3dc4 (patch) | |
tree | 36fae759158bc54baff8044599edc54fd8f5beb6 /activestorage | |
parent | 36468bd2dc6d3fb36dc9d81aa75306d954fa3b22 (diff) | |
parent | 2bad3f46cdd8decee7d2d9b804ac7c75b5a1cc5d (diff) | |
download | rails-9e34df00039d63b5672315419e76f06f80ef3dc4.tar.gz rails-9e34df00039d63b5672315419e76f06f80ef3dc4.tar.bz2 rails-9e34df00039d63b5672315419e76f06f80ef3dc4.zip |
Merge pull request #33419 from bogdanvlviv/update-active_storage
`rake app:update` should update active_storage
Diffstat (limited to 'activestorage')
-rw-r--r-- | activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb | 7 | ||||
-rw-r--r-- | activestorage/lib/tasks/activestorage.rake | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb b/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb new file mode 100644 index 0000000000..6830203cd6 --- /dev/null +++ b/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb @@ -0,0 +1,7 @@ +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 diff --git a/activestorage/lib/tasks/activestorage.rake b/activestorage/lib/tasks/activestorage.rake index ac254d717f..6b0469636c 100644 --- a/activestorage/lib/tasks/activestorage.rake +++ b/activestorage/lib/tasks/activestorage.rake @@ -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 |