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

class CreateSearchIndices < Gitlab::Database::Migration[2.1]
  enable_lock_retries!

  def change
    create_table :search_indices do |t|
      t.timestamps_with_timezone null: false
      t.integer :bucket_number # We allow null bucket numbers to support custom index assignments
      t.text :path, null: false, limit: 255
      t.text :type, null: false, limit: 255
    end

    add_index :search_indices, [:id, :type], unique: true
    add_index :search_indices, [:type, :path], unique: true
    add_index :search_indices, [:type, :bucket_number], unique: true
  end
end