Skip to content

Commit

Permalink
Update build for cipherstash-encrypt.sql to not include `ALTER DOMAIN…
Browse files Browse the repository at this point in the history
…` 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.
  • Loading branch information
CDThomas committed Oct 29, 2024
1 parent 3766a28 commit 9889069
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9889069

Please sign in to comment.