debian-mirror-gitlab/db/migrate/20230313012609_create_search_namespace_index_assignments.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
941 B
Ruby
Raw Normal View History

2023-06-20 00:43:36 +05:30
# frozen_string_literal: true
class CreateSearchNamespaceIndexAssignments < Gitlab::Database::Migration[2.1]
enable_lock_retries!
def change
create_table :search_namespace_index_assignments do |t|
t.references :namespace, foreign_key: true, null: true, on_delete: :nullify
t.bigint :search_index_id, index: true, null: false
t.bigint :namespace_id_non_nullable, null: false
t.timestamps_with_timezone null: false
t.integer :namespace_id_hashed, null: false
t.text :index_type, null: false, limit: 255
end
add_index :search_namespace_index_assignments,
[:namespace_id, :index_type],
unique: true,
name: 'index_search_namespace_index_assignments_uniqueness_index_type'
add_index :search_namespace_index_assignments,
[:namespace_id, :search_index_id],
unique: true,
name: 'index_search_namespace_index_assignments_uniqueness_on_index_id'
end
end