replacements: add media_asset_id, old_media_asset_id columns.

Add media_asset_id and old_media_asset_id columns for associating replacements with media assets.
This way we can easily tell which replacements don't have a media asset (with the md5 alone we can't
tell whether the media asset actually exists).
This commit is contained in:
evazion
2022-11-08 23:39:01 -06:00
parent 83d14a281f
commit b472ae5c87
2 changed files with 58 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
class AddMediaAssetIdToPostReplacements < ActiveRecord::Migration[7.0]
def change
add_reference :post_replacements, :media_asset, type: :integer, null: true, index: true, foreign_key: { to_table: :media_assets }
add_reference :post_replacements, :old_media_asset, type: :integer, null: true, index: true, foreign_key: { to_table: :media_assets }
add_index :post_replacements, :md5
add_index :post_replacements, :old_md5
end
end