Add SQL Migration 05 From go-kms-wrapping (#2371)

* adding sql migration 05 from go-kms-wrapping

* rename file from 05 to 01 to match boundary standards

* move key rewrap to folder 47
pull/2396/head
Danielle 4 years ago committed by GitHub
parent d709b97e18
commit 07a4082aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,23 @@
-- make the required schema changes to upgrade the dependency:
-- github.com/hashicorp/go-kms-wrapping/extras/kms/v2
-- this migration is from:
-- https://github.com/hashicorp/go-kms-wrapping/blob/main/extras/kms/migrations/postgres/05_key_rewrap.up.sql
begin;
-- we need to make the key and version columns mutable in order to support
-- rewrapping the root key versions.
drop trigger kms_immutable_columns on kms_root_key_version;
create trigger kms_immutable_columns before update on kms_root_key_version
for each row execute procedure kms_immutable_columns('private_id', 'root_key_id', 'create_time');
-- we need to make the key and version columns mutable in order to support
-- rewrapping the data key version.
drop trigger kms_immutable_columns on kms_data_key_version;
create trigger kms_immutable_columns before update on kms_data_key_version
for each row execute procedure kms_immutable_columns('private_id', 'data_key_id', 'root_key_version_id', 'create_time');
commit;
Loading…
Cancel
Save