1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class AddUniqueNameIndexToLinks < ActiveRecord::Migration[4.2]
7 # Make sure PgPower is here. Otherwise the "where" will be ignored
8 # and we'll end up with a far too restrictive unique
9 # constraint. (Rails4 should work without PgPower, but that isn't
11 if not PgPower then raise "No partial column support" end
13 add_index(:links, [:tail_uuid, :name], unique: true,
14 where: "link_class='name'",
15 name: 'links_tail_name_unique_if_link_class_name')