discourse/db/migrate/20210913032326_add_for_topic_to_bookmarks.rb
Martin Brennan 41e19adb0d
DEV: Ignore reminder_type for bookmarks (#14349)
We don't actually use the reminder_type for bookmarks anywhere;
we are just storing it. It has no bearing on the UI. It used
to be relevant with the at_desktop bookmark reminders (see
fa572d3a7a6a3e107fdbc5f00e04d2bb990ab77d)

This commit marks the column as readonly, ignores it, and removes
the index, and it will be dropped in a later PR. Some plugins
are relying on reminder_type partially so some stubs have been
left in place to avoid errors.
2021-09-16 09:56:54 +10:00

12 lines
379 B
Ruby

# frozen_string_literal: true
class AddForTopicToBookmarks < ActiveRecord::Migration[6.1]
def change
add_column :bookmarks, :for_topic, :boolean, default: false, null: false
add_index :bookmarks, [:user_id, :post_id, :for_topic], unique: true
if index_exists?(:bookmarks, [:user_id, :post_id])
remove_index :bookmarks, [:user_id, :post_id]
end
end
end