Sha256: 86fc16f52573618a9f48a3d131ec3fc30edf5b839a0b58e5e77c5f264d08e653

Contents?: true

Size: 647 Bytes

Versions: 74

Compression:

Stored size: 647 Bytes

Contents

class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
  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

  def down
    return unless table_exists?(:active_storage_blobs)

    remove_column :active_storage_blobs, :service_name
  end
end

Version data entries

74 entries across 73 versions & 7 rubygems

Version Path
omg-activestorage-8.0.0.alpha9 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
omg-activestorage-8.0.0.alpha8 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
omg-activestorage-8.0.0.alpha7 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
omg-activestorage-8.0.0.alpha4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
omg-activestorage-8.0.0.alpha3 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.0 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.0.rc1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activestorage-7.1.3.4/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activestorage-7.0.8.4/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.0.beta3 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activestorage-7.0.5.1/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activestorage-7.0.5.1/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activestorage-7.0.5.1/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/activestorage-7.1.3.4/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.0.beta2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.3.4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.8.4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.7.8 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb