I... forgot the migration

This commit is contained in:
drusepth 2021-10-27 00:12:06 -07:00
parent 4a57426b8e
commit 6938631524

View File

@ -0,0 +1,17 @@
class AddServiceNameMigrationAgain < ActiveRecord::Migration[6.1]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
remove_column :active_storage_blobs, :service_name
end
end