-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact(server): create new list and lookup worker queries
- Loading branch information
1 parent
01186f0
commit 9ada784
Showing
12 changed files
with
269 additions
and
571 deletions.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
internal/db/schema/migrations/oss/postgres/94/01_split_worker_tag_table.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,54 @@ | ||
-- Copyright (c) HashiCorp, Inc. | ||
-- SPDX-License-Identifier: BUSL-1.1 | ||
|
||
begin; | ||
|
||
-- Create new tables for worker config and worker api tags | ||
create table server_worker_config_tag( | ||
worker_id wt_public_id | ||
constraint server_worker_fkey | ||
references server_worker (public_id) | ||
on delete cascade | ||
on update cascade, | ||
key wt_tagpair, | ||
value wt_tagpair, | ||
primary key (worker_id, key, value) | ||
); | ||
comment on table server_worker_config_tag is | ||
'server_worker_config_tag is a table where each row represents a worker config tag.'; | ||
|
||
create table server_worker_api_tag( | ||
worker_id wt_public_id | ||
constraint server_worker_fkey | ||
references server_worker (public_id) | ||
on delete cascade | ||
on update cascade, | ||
key wt_tagpair, | ||
value wt_tagpair, | ||
primary key (worker_id, key, value) | ||
); | ||
comment on table server_worker_api_tag is | ||
'server_worker_api_tag is a table where each row represents a worker api tag.'; | ||
|
||
-- Migrate from server_worker_tag to the new tables | ||
insert into server_worker_config_tag | ||
(worker_id, key, value) | ||
select worker_id, key, value | ||
from server_worker_tag | ||
where source = 'configuration'; | ||
|
||
insert into server_worker_api_tag | ||
(worker_id, key, value) | ||
select worker_id, key, value | ||
from server_worker_tag | ||
where source = 'api'; | ||
|
||
-- Removes view created in 86/01_server_worker_local_storage_state.up.sql | ||
-- This view is removed in favor of custom sql in query.go | ||
drop view server_worker_aggregate; | ||
|
||
-- Drop the old tables | ||
drop table server_worker_tag; | ||
drop table server_worker_tag_enm; | ||
|
||
commit; |
89 changes: 0 additions & 89 deletions
89
internal/db/schema/migrations/oss/postgres/99/01_split_worker_tag_table.up.sql
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.