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:
@@ -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
|
||||
Reference in New Issue
Block a user