media assets: add file_key, is_public columns.

`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.
This commit is contained in:
evazion
2022-05-04 22:03:25 -05:00
parent d511a6b6cf
commit 4ba993319a
5 changed files with 56 additions and 4 deletions

View File

@@ -0,0 +1,9 @@
class AddFileKeyToMediaAssets < ActiveRecord::Migration[7.0]
def change
add_column :media_assets, :file_key, :string, null: true
add_column :media_assets, :is_public, :boolean, default: true, null: false
add_index :media_assets, :file_key, unique: true
add_index :media_assets, :is_public, where: "is_public = FALSE"
end
end