|
20 | 20 |
|
21 | 21 | if database_type == :postgres |
22 | 22 | VCAP::Migration.with_concurrent_timeout(self) do |
23 | | - drop_index :security_groups, nil, |
24 | | - name: :sg_name_index, |
25 | | - concurrently: true, |
26 | | - if_exists: true |
27 | 23 | add_index :security_groups, :name, |
28 | 24 | name: :security_group_name_index, |
29 | 25 | unique: true, |
30 | 26 | concurrently: true, |
31 | 27 | if_not_exists: true |
| 28 | + drop_index :security_groups, nil, |
| 29 | + name: :sg_name_index, |
| 30 | + concurrently: true, |
| 31 | + if_exists: true |
32 | 32 | end |
33 | 33 | else |
34 | 34 | alter_table(:security_groups) do |
35 | 35 | # rubocop:disable Sequel/ConcurrentIndex -- MySQL does not support concurrent index operations |
36 | | - drop_index :name, name: :sg_name_index if @db.indexes(:security_groups).key?(:sg_name_index) |
37 | 36 | add_index :name, name: :security_group_name_index, unique: true unless @db.indexes(:security_groups).key?(:security_group_name_index) |
| 37 | + drop_index :name, name: :sg_name_index if @db.indexes(:security_groups).key?(:sg_name_index) |
38 | 38 | # rubocop:enable Sequel/ConcurrentIndex |
39 | 39 | end |
40 | 40 | end |
|
43 | 43 | down do |
44 | 44 | if database_type == :postgres |
45 | 45 | VCAP::Migration.with_concurrent_timeout(self) do |
46 | | - drop_index :security_groups, nil, |
47 | | - name: :security_group_name_index, |
48 | | - concurrently: true, |
49 | | - if_exists: true |
50 | 46 | add_index :security_groups, :name, |
51 | 47 | name: :sg_name_index, |
52 | 48 | concurrently: true, |
53 | 49 | if_not_exists: true |
| 50 | + drop_index :security_groups, nil, |
| 51 | + name: :security_group_name_index, |
| 52 | + concurrently: true, |
| 53 | + if_exists: true |
54 | 54 | end |
55 | 55 | else |
56 | 56 | alter_table(:security_groups) do |
57 | 57 | # rubocop:disable Sequel/ConcurrentIndex -- MySQL does not support concurrent index operations |
58 | | - drop_index :name, name: :security_group_name_index if @db.indexes(:security_groups).key?(:security_group_name_index) |
59 | 58 | add_index :name, name: :sg_name_index unless @db.indexes(:security_groups).key?(:sg_name_index) |
| 59 | + drop_index :name, name: :security_group_name_index if @db.indexes(:security_groups).key?(:security_group_name_index) |
60 | 60 | # rubocop:enable Sequel/ConcurrentIndex |
61 | 61 | end |
62 | 62 | end |
|
0 commit comments