method

up

Importance_0
v7.1.3.4 - Show latest stable - 0 notes - Class: AddServiceNameToActiveStorageBlobs
up() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activestorage/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb, line 2
  def up
    return unless table_exists?(:active_storage_blobs)

    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
Register or log in to add new notes.