discourse/db/migrate/20200715044833_add_delete_option_to_bookmarks.rb
Martin Brennan 41b43a2a25
FEATURE: Add "delete on owner reply" bookmark functionality (#10231)
This adds an option to "delete on owner reply" to bookmarks. If you select this option in the modal, then reply to the topic the bookmark is in, the bookmark will be deleted on reply.

This PR also changes the checkboxes for these additional bookmark options to an Integer column in the DB with a combobox to select the option you want.

The use cases are:

* Sometimes I will bookmark the topics to read it later. In this case we definitely don’t need to keep the bookmark after I replied to it.
* Sometimes I will read the topic in mobile and I will prefer to reply in PC later. Or I may have to do some research before reply. So I will bookmark it for reply later.
2020-07-21 10:00:39 +10:00

13 lines
380 B
Ruby

# frozen_string_literal: true
class AddDeleteOptionToBookmarks < ActiveRecord::Migration[6.0]
def up
add_column :bookmarks, :auto_delete_preference, :integer, index: true, null: false, default: 0
DB.exec("UPDATE bookmarks SET auto_delete_preference = 1 WHERE delete_when_reminder_sent")
end
def down
remove_column :bookmarks, :auto_delete_preference
end
end