feat(vault): Remove database notice when setting credential type

This notice just generated noise, particuarlly in some of the sqltests.
This commit is contained in:
Timothy Messier committed 2024-02-23 15:44:08 +00:00
1 parent 9d82958c9f
commit e51d0e0b4f
2 files changed
+24

No files matched your search

@@ -136,6 +136,7 @@ begin;
comment on table credential_vault_ssh_cert_library is
'credential_vault_ssh_cert_library a credential library that issues credentials from a vault ssh secret backend.';
-- Replaced in 82/07_vault_ssh_cert_default.up.sql
create function default_ssh_certificate_credential_type() returns trigger
as $$
begin
@@ -0,0 +1,23 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1
begin;
drop trigger default_ssh_certificate_credential_type on credential_vault_ssh_cert_library;
drop function default_ssh_certificate_credential_type;
-- Replaces trigger in 63/01_credential_vault_ssh_cert_library.up.sql
create function default_ssh_certificate_credential_type() returns trigger
as $$
begin
if new.credential_type is distinct from 'ssh_certificate' then
new.credential_type = 'ssh_certificate';
end if;
return new;
end;
$$ language plpgsql;
comment on function default_ssh_certificate_credential_type is
'default_ssh_certificate_credential_type ensures the credential_type is set to ssh_certificate';
create trigger default_ssh_certificate_credential_type before insert on credential_vault_ssh_cert_library
for each row execute procedure default_ssh_certificate_credential_type();
commit;