DEV: Replace 'processed' column on notifications with new table (#11864)

This commit is contained in:
Mark VanLandingham
2021-01-27 10:29:24 -06:00
committed by GitHub
parent 60f10e9067
commit 809274fe0d
12 changed files with 61 additions and 46 deletions

View File

@@ -1,14 +1,6 @@
# frozen_string_literal: true
class AddProcessedToNotifications < ActiveRecord::Migration[6.0]
def up
add_column :notifications, :processed, :boolean, default: false
execute "UPDATE notifications SET processed = true"
change_column_null(:notifications, :processed, false)
add_index :notifications, [:processed], unique: false
end
def down
remove_column :notifications, :processed
def change
end
end

View File

@@ -0,0 +1,9 @@
# frozen_string_literal: true
class CreateShelvedNotifications < ActiveRecord::Migration[6.0]
def change
create_table :shelved_notifications do |t|
t.integer :notification_id, null: false
end
add_index :shelved_notifications, [:notification_id]
end
end

View File

@@ -0,0 +1,6 @@
# frozen_string_literal: true
class UndoAddProcessedToNotifications < ActiveRecord::Migration[6.0]
def up
execute "ALTER TABLE notifications DROP COLUMN IF EXISTS processed"
end
end