mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-08-25 01:44:52 +00:00
before. In the API, attachments now can be either image, video or gifv. Gifv is to be treated like images in terms of behaviour, but are videos by file type.
13 lines
477 B
Ruby
13 lines
477 B
Ruby
class AddTypeToMediaAttachments < ActiveRecord::Migration[5.0]
|
|
def up
|
|
add_column :media_attachments, :type, :integer, default: 0, null: false
|
|
|
|
MediaAttachment.where(file_content_type: MediaAttachment::IMAGE_MIME_TYPES).update_all(type: MediaAttachment.types[:image])
|
|
MediaAttachment.where(file_content_type: MediaAttachment::VIDEO_MIME_TYPES).update_all(type: MediaAttachment.types[:video])
|
|
end
|
|
|
|
def down
|
|
remove_column :media_attachments, :type
|
|
end
|
|
end
|