4823: Add new tests for BufferBlock, BlockManager, saving, updating. Stylistic
[arvados.git] / services / api / db / migrate / 20140501165548_add_unique_name_index_to_links.rb
1 class AddUniqueNameIndexToLinks < ActiveRecord::Migration
2   def change
3     # Make sure PgPower is here. Otherwise the "where" will be ignored
4     # and we'll end up with a far too restrictive unique
5     # constraint. (Rails4 should work without PgPower, but that isn't
6     # tested.)
7     if not PgPower then raise "No partial column support" end
8
9     add_index(:links, [:tail_uuid, :name], unique: true,
10               where: "link_class='name'",
11               name: 'links_tail_name_unique_if_link_class_name')
12   end
13 end