discourse/db/migrate/20200715044833_add_delete_option_to_bookmarks.rb
Jarek Radosz 21c3a512a2
DEV: Remove invalid options from migrations (#34384)
The change is sponsored by `Rails/AddColumnIndex` rubocop rule:

> (…) add_column does not accept index, but also does not raise an error
for extra keys, so it is possible to mistakenly add the key without
realizing it will not actually add an index.

I opted not to add these "missing" indexes since they've proven not
necessary after all.
2025-08-19 17:35:50 +02:00

12 lines
367 B
Ruby

# frozen_string_literal: true
class AddDeleteOptionToBookmarks < ActiveRecord::Migration[6.0]
def up
add_column :bookmarks, :auto_delete_preference, :integer, 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