Merge branch 'main' from workbench2.git
[arvados.git] / services / api / db / migrate / 20181213183234_add_expression_index_to_links.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class AddExpressionIndexToLinks < ActiveRecord::Migration[4.2]
6   def up
7     ActiveRecord::Base.connection.execute 'CREATE INDEX index_links_on_substring_head_uuid on links (substring(head_uuid, 7, 5))'
8     ActiveRecord::Base.connection.execute 'CREATE INDEX index_links_on_substring_tail_uuid on links (substring(tail_uuid, 7, 5))'
9   end
10
11   def down
12     ActiveRecord::Base.connection.execute 'DROP INDEX index_links_on_substring_head_uuid'
13     ActiveRecord::Base.connection.execute 'DROP INDEX index_links_on_substring_tail_uuid'
14   end
15 end