`file_key` is a random 9-character base-62 string that will be used as the image filename in the future. `is_public` is whether the image can be viewed without authentication or not. Users running downstream boorus must run `bin/rails db:migrate` and `script/fixes/109_generate_media_asset_file_keys.rb` after this commit.
9 lines
221 B
Ruby
Executable File
9 lines
221 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require_relative "base"
|
|
|
|
MediaAsset.where(file_key: nil).parallel_each do |asset|
|
|
asset.update_columns(file_key: MediaAsset.generate_file_key)
|
|
puts "id=#{asset.id} file_key=#{asset.file_key}"
|
|
end
|