2019-01-14 19:56:35 +00:00
|
|
|
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
|
|
|
|
def up
|
|
|
|
unless column_exists?(:active_storage_blobs, :service_name)
|
|
|
|
add_column :active_storage_blobs, :service_name, :string
|
|
|
|
|
2019-10-01 20:54:37 +00:00
|
|
|
if configured_service = ActiveStorage::Blob.service.name
|
2019-01-14 19:56:35 +00:00
|
|
|
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
|
|
|
|
end
|
|
|
|
|
|
|
|
change_column :active_storage_blobs, :service_name, :string, null: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|