diff --git a/13.0/pre_upgrade.sh b/13.0/pre_upgrade.sh index 918dd2d..66c0d87 100755 --- a/13.0/pre_upgrade.sh +++ b/13.0/pre_upgrade.sh @@ -17,6 +17,20 @@ EOF ) query_postgres_container "$PRE_MIGRATE_SQL" ou13 || exit 1 +# Digital currency specific - to comment if not needed +INVOICE_NAME_SQL=$(cat <<'EOF' +ALTER TABLE credit_request ADD invoice_name VARCHAR; +UPDATE credit_request +SET invoice_name = ( + SELECT move_name + FROM account_invoice + WHERE account_invoice.id = credit_request.invoice_id +); +UPDATE credit_request SET invoice_id = NULL; +EOF + ) +query_postgres_container "$INVOICE_NAME_SQL" ou13 || exit 1 + # Copy filestores copy_filestore ou12 ou12 ou13 ou13 || exit 1 diff --git a/16.0/post_upgrade.sh b/16.0/post_upgrade.sh index e69de29..51129b2 100755 --- a/16.0/post_upgrade.sh +++ b/16.0/post_upgrade.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "POST migration to 16.0..." + +# Digital currency specific - to comment if not needed +INVOICE_NAME_SQL=$(cat <<'EOF' +UPDATE credit_request +SET invoice_id = ( + SELECT id + FROM account_move + WHERE account_move.name = credit_request.invoice_name +); +EOF +) +query_postgres_container "$INVOICE_NAME_SQL" ou16 || exit 1 + +echo "END POST migration to 16.0."