This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2023-07-12 03:47:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-04 16:17:10 -05:00
|
|
|
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
|