class CreateWhalebackMediaObjsAndMediaAttachments < ActiveRecord::Migration[5.1]
  def change
    create_table :whaleback_media_objs do |t|
      t.attachment :file
      t.string     :type

      t.references :creator, polymorphic: true, index: { name: :whaleback_poly_creator }
      t.timestamps
    end

    create_table :whaleback_media_attachments do |t|
      t.string     :column_name

      t.references :attached, polymorphic: true, index: { name: :whaleback_poly_attached }
      t.references :obj
      t.timestamps
    end
  end
end