Merge branch 'master' into 12018-sync-groups-tool
[arvados.git] / services / api / db / migrate / 20140402001908_add_system_group.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class AddSystemGroup < ActiveRecord::Migration
6   include CurrentApiClient
7
8   def up
9     # Make sure the system group exists.
10     system_group
11   end
12
13   def down
14     act_as_system_user do
15       system_group.destroy
16
17       # Destroy the automatically generated links giving system_group
18       # permission on all users.
19       Link.destroy_all(tail_uuid: system_group_uuid, head_kind: 'arvados#user')
20     end
21   end
22 end