diff --git a/internal/db/schema/migrations/oss/postgres/63/01_credential_vault_ssh_cert_library.up.sql b/internal/db/schema/migrations/oss/postgres/63/01_credential_vault_ssh_cert_library.up.sql index 7d82ee378f..d41f9a11f3 100644 --- a/internal/db/schema/migrations/oss/postgres/63/01_credential_vault_ssh_cert_library.up.sql +++ b/internal/db/schema/migrations/oss/postgres/63/01_credential_vault_ssh_cert_library.up.sql @@ -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 diff --git a/internal/db/schema/migrations/oss/postgres/82/07_vault_ssh_cert_default.up.sql b/internal/db/schema/migrations/oss/postgres/82/07_vault_ssh_cert_default.up.sql new file mode 100644 index 0000000000..21695b7a92 --- /dev/null +++ b/internal/db/schema/migrations/oss/postgres/82/07_vault_ssh_cert_default.up.sql @@ -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;