Skip to content

Commit 6938631

Browse files
committed
I... forgot the migration
1 parent 4a57426 commit 6938631

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class AddServiceNameMigrationAgain < ActiveRecord::Migration[6.1]
2+
def up
3+
unless column_exists?(:active_storage_blobs, :service_name)
4+
add_column :active_storage_blobs, :service_name, :string
5+
6+
if configured_service = ActiveStorage::Blob.service.name
7+
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
8+
end
9+
10+
change_column :active_storage_blobs, :service_name, :string, null: false
11+
end
12+
end
13+
14+
def down
15+
remove_column :active_storage_blobs, :service_name
16+
end
17+
end

0 commit comments

Comments
 (0)