-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store: Change the primary key on subgraph_deployment
Make 'id' the primary key on subgraph_deployment so that entries there are identified with the same id as entries in deployment_schemas
- Loading branch information
Showing
4 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
store/postgres/migrations/2021-03-12-014815_subgraph_deployment_pkey/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
do $$ | ||
begin | ||
raise 'This migration is irreversible'; | ||
end | ||
$$; |
14 changes: 14 additions & 0 deletions
14
store/postgres/migrations/2021-03-12-014815_subgraph_deployment_pkey/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
update subgraphs.subgraph_deployment d | ||
set id = ds.id | ||
from deployment_schemas ds | ||
where ds.subgraph = d.deployment | ||
and d.id is null; | ||
|
||
alter table subgraphs.subgraph_deployment | ||
drop constraint subgraph_deployment_pkey; | ||
|
||
alter table subgraphs.subgraph_deployment | ||
add primary key(id); | ||
|
||
alter table subgraphs.subgraph_deployment | ||
drop column vid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters