Skip to content

Commit 8157370

Browse files
authored
Remove migration views (#3664)
* Remove migration views After merging #3394 and #3393 we can remove the views we introduced for annotations and labels tables. This is a breaking change, migrating from a CF-Deployment version before PR 3394 to a version that removes the view will cause a downtime on the old CCs since they still use the views. * remove if_exists=true for create_view, this option is not valid for create_view
1 parent a655a6f commit 8157370

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Sequel.migration do
2+
table_base_names = %w[
3+
app
4+
build
5+
buildpack
6+
deployment
7+
domain
8+
droplet
9+
isolation_segment
10+
organization
11+
package
12+
process
13+
revision
14+
route_binding
15+
route
16+
service_binding
17+
service_broker
18+
service_broker_update_request
19+
service_instance
20+
service_key
21+
service_offering
22+
service_plan
23+
space
24+
stack
25+
task
26+
user
27+
].freeze
28+
annotation_tables = table_base_names.map { |tbn| "#{tbn}_annotations" }.freeze
29+
label_tables = table_base_names.map { |tbn| "#{tbn}_labels" }.freeze
30+
31+
no_transaction # Disable automatic transactions
32+
33+
up do
34+
(annotation_tables + label_tables).each do |table|
35+
transaction do
36+
drop_view(:"#{table}_migration_view", if_exists: true)
37+
end
38+
end
39+
end
40+
41+
down do
42+
(annotation_tables + label_tables).each do |table|
43+
transaction do
44+
create_view(:"#{table}_migration_view", self[table.to_sym].select { [id, guid, created_at, updated_at, resource_guid, key_prefix, key_name, value] })
45+
end
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)