Handle non-nil, empty Instances return refs #20978
[arvados.git] / services / api / db / migrate / 20200914203202_public_favorites_project.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class PublicFavoritesProject < ActiveRecord::Migration[5.2]
6   include CurrentApiClient
7   def up
8     act_as_system_user do
9       public_project_group
10       public_project_read_permission
11       Link.where(link_class: "star",
12                  owner_uuid: system_user_uuid,
13                  tail_uuid: all_users_group_uuid).each do |ln|
14         ln.owner_uuid = public_project_uuid
15         ln.tail_uuid = public_project_uuid
16         ln.save!
17       end
18     end
19   end
20
21   def down
22   end
23 end