19890: Use 64 bit ints for id columns.
[arvados.git] / services / api / db / migrate / 20140501165548_add_unique_name_index_to_links.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class AddUniqueNameIndexToLinks < ActiveRecord::Migration[4.2]
6   def change
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
10     # tested.)
11     if not PgPower then raise "No partial column support" end
12
13     add_index(:links, [:tail_uuid, :name], unique: true,
14               where: "link_class='name'",
15               name: 'links_tail_name_unique_if_link_class_name')
16   end
17 end