summaryrefslogtreecommitdiff
path: root/db/migrate/20230406150254_create_agent_user_access_project_authorizations_table.rb
blob: 1adc3bb001a7d7854344da0588dc4868ad2dbc32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class CreateAgentUserAccessProjectAuthorizationsTable < Gitlab::Database::Migration[2.1]
  INDEX_NAME_1 = 'index_agent_user_access_on_project_id'
  INDEX_NAME_2 = 'index_agent_user_access_on_agent_id_and_project_id'

  def change
    create_table :agent_user_access_project_authorizations do |t|
      t.bigint :project_id, null: false
      t.bigint :agent_id, null: false
      t.jsonb :config, null: false

      t.index [:project_id], name: INDEX_NAME_1
      t.index [:agent_id, :project_id], unique: true, name: INDEX_NAME_2
    end
  end
end