feat(credentials): Refactor credential purposes (#2260)

* feat(credentials): Refactor credential purposes

 * Application credentials have been refactored to Brokered credentials
 * Egress credentials have been refactored to Injected Application
credentials

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
Louis RuchandJeff Mitchell authored and GitHub committed 2022-07-19 15:16:24 -07:00
1 parent 271cc8f781
commit a17e973712
49 files changed
+1516 -1051

No files matched your search

@@ -239,6 +239,7 @@ begin;
create table credential_purpose_enm (
name text primary key
-- This constraint is updated in 40/01_credential.up.sql
constraint only_predefined_credential_purposes_allowed
check (
name in (
@@ -252,6 +253,7 @@ begin;
'credential_purpose_enm is an enumeration table for credential purposes. '
'It contains rows for representing the application, egress, and ingress credential purposes.';
-- These values are updated in 40/01_credential.up.sql
insert into credential_purpose_enm (name)
values
('application'),
@@ -0,0 +1,37 @@
begin;
-- drop constraint so we can migrate enm values
alter table credential_purpose_enm
drop constraint only_predefined_credential_purposes_allowed;
-- update egress to injected_application
update credential_purpose_enm
set name = 'injected_application'
where name = 'egress';
-- update application to brokered
update credential_purpose_enm
set name = 'brokered'
where name = 'application';
-- delete ingress as it will no longer be used
delete from credential_purpose_enm
where name = 'ingress';
-- Add new constraint that only allows 'brokered' and new 'injected_application'
-- This replaces the constraint defined in 10/03_credential.up.sql
alter table credential_purpose_enm
add constraint only_predefined_credential_purposes_allowed
check (
name in (
'brokered',
'injected_application'
)
);
-- update comment on table
comment on table credential_purpose_enm is
'credential_purpose_enm is an enumeration table for credential purposes. '
'It contains rows for representing the brokered, and injected_application credential purposes.';
commit;
@@ -0,0 +1,13 @@
begin;
-- update egress to injected_application
update wh_credential_dimension
set credential_purpose = 'injected_application'
where credential_purpose = 'egress';
-- update application to brokered
update wh_credential_dimension
set credential_purpose = 'brokered'
where credential_purpose = 'application';
commit;