Enable bash strict mode in all shell scripts to catch errors early: - set -e: Exit immediately if a command exits with non-zero status - set -u: Treat unset variables as an error - set -o pipefail: Return value of a pipeline is the status of the last command to exit with non-zero status This prevents silent failures and makes debugging easier by failing fast when something goes wrong instead of continuing with potentially corrupted state.
21 lines
495 B
Bash
Executable File
21 lines
495 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "Prepare migration to 18.0..."
|
|
|
|
# Copy database
|
|
copy_database ou17 ou18 ou18 || exit 1
|
|
|
|
# Execute SQL pre-migration commands
|
|
PRE_MIGRATE_SQL=$(cat <<'EOF'
|
|
UPDATE account_analytic_plan SET default_applicability=NULL WHERE default_applicability='optional';
|
|
EOF
|
|
)
|
|
echo "SQL command = $PRE_MIGRATE_SQL"
|
|
query_postgres_container "$PRE_MIGRATE_SQL" ou18 || exit 1
|
|
|
|
# Copy filestores
|
|
copy_filestore ou17 ou17 ou18 ou18 || exit 1
|
|
|
|
echo "Ready for migration to 18.0!"
|