2023-01-27 16:21:16 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Create notification preferences : allow user to decide which type of notifications
|
|
|
|
# they want to receive via push ('in system') or via email.
|
|
|
|
class CreateNotificationPreferences < ActiveRecord::Migration[5.2]
|
|
|
|
def change
|
|
|
|
create_table :notification_preferences do |t|
|
2023-02-02 13:37:09 +01:00
|
|
|
t.references :user, index: false, foreign_key: true, null: false
|
2023-01-27 16:21:16 +01:00
|
|
|
t.references :notification_type, index: true, foreign_key: true, null: false
|
|
|
|
t.boolean :in_system, default: true
|
|
|
|
t.boolean :email, default: true
|
|
|
|
|
2023-02-02 13:37:09 +01:00
|
|
|
t.index %i[user_id notification_type_id], unique: true, name: :index_notification_preferences_on_user_and_notification_type
|
|
|
|
|
2023-01-27 16:21:16 +01:00
|
|
|
t.timestamps
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|