* 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>
38 lines
1.1 KiB
PL/PgSQL
38 lines
1.1 KiB
PL/PgSQL
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;
|