Sha256: 98b6ad10b79796fe1a5a9ae67c721a1278712a54242e36f4f90ebf0965549e15

Contents?: true

Size: 535 Bytes

Versions: 40

Compression:

Stored size: 535 Bytes

Contents

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

Version data entries

40 entries across 38 versions & 4 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activestorage-6.1.6.1/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activestorage-7.0.2.3/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activestorage-7.0.2.3/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activestorage-6.1.6.1/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.6.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.6 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.2.4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.5.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.5 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.2.3 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.4.7 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.2.2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.4.6 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.4.5 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.2.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.2 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.1 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.0 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-6.1.4.4 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb
activestorage-7.0.0.rc3 db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb