FIX: Migration to set column NOT NULL for delete_when_reminder_sent on bookmarks (#9696)

Also fix typo in original migration.

Meta: https://meta.discourse.org/t/improved-bookmarks-with-reminders/144542/152?u=mjrbrennan
This commit is contained in:
Martin Brennan 2020-05-08 10:43:23 +10:00 committed by GitHub
parent ef94b0f1a7
commit e83dc75238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,6 @@
class AddDeleteWhenReminderSentBooleanToBookmarks < ActiveRecord::Migration[6.0]
def change
add_column :bookmarks, :delete_when_reminder_sent, :boolean, nullabe: false, default: false
add_column :bookmarks, :delete_when_reminder_sent, :boolean, null: false, default: false
end
end

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
class EnsureBookmarkDeleteWhenReminderSentNotNull < ActiveRecord::Migration[6.0]
def change
DB.exec("UPDATE bookmarks SET delete_when_reminder_sent = false WHERE delete_when_reminder_sent IS NULL")
change_column_null :bookmarks, :delete_when_reminder_sent, false
end
end