change default value setting

change users migration not to lock the table by directly setting
the default value of the accept_desktop_notifications colums
when running the migration
This commit is contained in:
Nuwan 2024-03-16 10:52:32 +05:30
parent 17b0ea6111
commit 1c0a6b2138
1 changed files with 1 additions and 1 deletions

View File

@ -1,6 +1,6 @@
class AddAcceptDesktopNotificationsToUsers < ActiveRecord::Migration
def self.up
execute("ALTER TABLE public.users ADD COLUMN accept_desktop_notifications BOOLEAN DEFAULT false;")
execute("ALTER TABLE public.users ADD COLUMN accept_desktop_notifications BOOLEAN; UPDATE public.users SET accept_desktop_notifications = FALSE;")
end
def self.down
execute("ALTER TABLE public.users DROP COLUMN accept_desktop_notifications;")