diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /db/migrate/20201125233219_add_incident_management_on_call_participants.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'db/migrate/20201125233219_add_incident_management_on_call_participants.rb')
-rw-r--r-- | db/migrate/20201125233219_add_incident_management_on_call_participants.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20201125233219_add_incident_management_on_call_participants.rb b/db/migrate/20201125233219_add_incident_management_on_call_participants.rb new file mode 100644 index 00000000000..2a9b1d8b276 --- /dev/null +++ b/db/migrate/20201125233219_add_incident_management_on_call_participants.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class AddIncidentManagementOnCallParticipants < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + PARTICIPANT_ROTATION_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_rotation_id' + PARTICIPANT_USER_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_oncall_user_id' + UNIQUE_INDEX_NAME = 'index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id' + + disable_ddl_transaction! + + def up + unless table_exists?(:incident_management_oncall_participants) + with_lock_retries do + create_table :incident_management_oncall_participants do |t| + t.references :oncall_rotation, index: false, null: false, foreign_key: { to_table: :incident_management_oncall_rotations, on_delete: :cascade } + t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade } + t.integer :color_palette, limit: 2, null: false + t.integer :color_weight, limit: 2, null: false + t.index :user_id, name: PARTICIPANT_USER_INDEX_NAME + t.index :oncall_rotation_id, name: PARTICIPANT_ROTATION_INDEX_NAME + t.index [:user_id, :oncall_rotation_id], unique: true, name: UNIQUE_INDEX_NAME + end + end + end + end + + def down + drop_table :incident_management_oncall_participants + end +end |