Merge pull request #6494 from aignatov-bio/ai-sci-fix-notification-migration

Fix notifications migration
This commit is contained in:
Martin Artnik 2023-10-19 10:04:59 +02:00 committed by GitHub
commit 21ad72248d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ class MigrateNotificationToNoticed < ActiveRecord::Migration[7.0]
end end
def up def up
add_column :notifications, :params, :jsonb, default: {}, null: false add_column :notifications, :params, :jsonb
add_column :notifications, :type, :string add_column :notifications, :type, :string
add_column :notifications, :read_at, :datetime add_column :notifications, :read_at, :datetime
add_reference :notifications, :recipient, polymorphic: true add_reference :notifications, :recipient, polymorphic: true
@ -49,6 +49,8 @@ class MigrateNotificationToNoticed < ActiveRecord::Migration[7.0]
drop_table :user_notifications drop_table :user_notifications
change_column_null :notifications, :type, false change_column_null :notifications, :type, false
change_column_null :notifications, :params, false
change_column_default :notifications, :params, {}
remove_column :notifications, :type_of remove_column :notifications, :type_of
remove_column :notifications, :title remove_column :notifications, :title