diff options
Diffstat (limited to 'db/migrate/20200521225327_create_alert_management_alert_assignees.rb')
-rw-r--r-- | db/migrate/20200521225327_create_alert_management_alert_assignees.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20200521225327_create_alert_management_alert_assignees.rb b/db/migrate/20200521225327_create_alert_management_alert_assignees.rb new file mode 100644 index 00000000000..095b2fdfeee --- /dev/null +++ b/db/migrate/20200521225327_create_alert_management_alert_assignees.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateAlertManagementAlertAssignees < ActiveRecord::Migration[6.0] + DOWNTIME = false + + ALERT_INDEX_NAME = 'index_alert_assignees_on_alert_id' + UNIQUE_INDEX_NAME = 'index_alert_assignees_on_user_id_and_alert_id' + + def up + create_table :alert_management_alert_assignees do |t| + t.bigint :user_id, null: false + t.bigint :alert_id, null: false + + t.index :alert_id, name: ALERT_INDEX_NAME + t.index [:user_id, :alert_id], unique: true, name: UNIQUE_INDEX_NAME + end + end + + def down + # rubocop:disable Migration/DropTable + drop_table :alert_management_alert_assignees + # rubocop:enable Migration/DropTable + end +end |