From 98890693ce791292b1dffd7441e3b67f73a5d271 Mon Sep 17 00:00:00 2001 From: Drew Thomas Date: Tue, 29 Oct 2024 18:30:33 +1100 Subject: [PATCH] Update build for cipherstash-encrypt.sql to not include `ALTER DOMAIN` statements at top of file These were causing cipherstash-encrypt.sql to fail if the domains being altered didn't already exist. Instead, only include `ALTER DOMAIN` statements at the top of the uninstall script. --- justfile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/justfile b/justfile index 084f7f9..7e4a6a6 100644 --- a/justfile +++ b/justfile @@ -32,26 +32,33 @@ build: # Collect all the drops # In reverse order (tac) so that we drop the constraints before the tables - grep -h -E '^(DROP|ALTER DOMAIN [^ ]+ DROP CONSTRAINT)' sql/0*-*.sql | tac > release/cipherstash-encrypt-tmp-drop.sql + grep -h -E '^(DROP)' sql/0*-*.sql | tac > release/cipherstash-encrypt-tmp-drop-install.sql # types are always last - cat sql/666-drop_types.sql >> release/cipherstash-encrypt-tmp-drop.sql + cat sql/666-drop_types.sql >> release/cipherstash-encrypt-tmp-drop-install.sql # Build cipherstash-encrypt.sql # drop everything first - cat release/cipherstash-encrypt-tmp-drop.sql > release/cipherstash-encrypt.sql + cat release/cipherstash-encrypt-tmp-drop-install.sql > release/cipherstash-encrypt.sql # cat the rest of the sql files cat sql/0*-*.sql >> release/cipherstash-encrypt.sql + # Collect all the drops + # In reverse order (tac) so that we drop the constraints before the tables + grep -h -E '^(DROP|ALTER DOMAIN [^ ]+ DROP CONSTRAINT)' sql/0*-*.sql | tac > release/cipherstash-encrypt-tmp-drop-uninstall.sql + # types are always last + cat sql/666-drop_types.sql >> release/cipherstash-encrypt-tmp-drop-uninstall.sql + # Build cipherstash-encrypt-uninstall.sql # prepend the drops to the main sql file - cat release/cipherstash-encrypt-tmp-drop.sql >> release/cipherstash-encrypt-uninstall.sql + cat release/cipherstash-encrypt-tmp-drop-uninstall.sql >> release/cipherstash-encrypt-uninstall.sql # uninstall renames configuration table cat sql/666-rename_configuration_table.sql >> release/cipherstash-encrypt-uninstall.sql # remove the drop file - rm release/cipherstash-encrypt-tmp-drop.sql + rm release/cipherstash-encrypt-tmp-drop-install.sql + rm release/cipherstash-encrypt-tmp-drop-uninstall.sql reset: