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
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/activestorage-7.1.3.4/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.0.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.2.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.5.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.8.7 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.0 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.5 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.0.rc2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.1.2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.4.2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.8.6 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.7.10 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.0.rc1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.7.9 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.2.1.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.1.4.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.8.5 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-8.0.0.beta1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb