Files
0k-odoo-upgrade/15.0/pre_upgrade.sh
Stéphan Sainléger 30909a3b28 [IMP] add strict mode (set -euo pipefail) to all scripts
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.
2026-02-02 20:06:27 +01:00

23 lines
660 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
echo "Prepare migration to 15.0..."
# Copy database
copy_database ou14 ou15 ou15 || exit 1
# Execute SQL pre-migration commands
PRE_MIGRATE_SQL=$(cat <<'EOF'
/* Delete add-on 'account_usability' as its name has changed and another 'account_usability' add-on is created */
DELETE FROM ir_module_module WHERE name = 'account_usability';
DELETE FROM ir_model_data WHERE module = 'base' AND name = 'module_account_usability';
EOF
)
echo "SQL command = $PRE_MIGRATE_SQL"
query_postgres_container "$PRE_MIGRATE_SQL" ou15 || exit 1
# Copy filestores
copy_filestore ou14 ou14 ou15 ou15 || exit 1
echo "Ready for migration to 15.0!"