Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit ff97a50

Browse files
author
Derik Evangelista
authored
v2/v3(bindings): allow only one binding per app/SI (cloudfoundry#1901)
Solves cloudfoundry#1872
1 parent 47c1480 commit ff97a50

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Sequel.migration do
2+
up do
3+
# We are assuming with this DB migration that the service_bindings table currently
4+
# has no duplicate rows, according to the unique constraint of
5+
# (service_instance_guid, app_guid). This migration will fail otherwise.
6+
#
7+
# Please manually remove duplicate entries from the database if
8+
# this migration is failing.
9+
10+
alter_table :service_bindings do
11+
add_unique_constraint [:service_instance_guid, :app_guid], name: :unique_service_binding_service_instance_guid_app_guid
12+
add_unique_constraint [:app_id, :route_id, :app_port], name: :apps_routes_app_id_route_id_app_port_key
13+
end
14+
end
15+
16+
down do
17+
alter_table :service_bindings do
18+
drop_constraint :unique_service_binding_service_instance_guid_app_guid
19+
end
20+
end
21+
end

0 commit comments

Comments
 (0)