1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class TrashableGroups < ActiveRecord::Migration
7 add_column :groups, :trash_at, :datetime
8 add_index(:groups, :trash_at)
10 add_column :groups, :is_trashed, :boolean, null: false, default: false
11 add_index(:groups, :is_trashed)
13 add_column :groups, :delete_at, :datetime
14 add_index(:groups, :delete_at)
16 Group.reset_column_information
17 add_index(:groups, [:owner_uuid, :name],
19 where: 'is_trashed = false',
20 name: 'index_groups_on_owner_uuid_and_name')
22 name: 'groups_owner_uuid_name_unique')
27 add_index(:groups, [:owner_uuid, :name], unique: true,
28 name: 'groups_owner_uuid_name_unique')
30 name: 'index_groups_on_owner_uuid_and_name')
32 remove_index(:groups, :delete_at)
33 remove_column(:groups, :delete_at)
35 remove_index(:groups, :is_trashed)
36 remove_column(:groups, :is_trashed)
38 remove_index(:groups, :trash_at)
39 remove_column(:groups, :trash_at)