@@ -10,10 +10,11 @@ help() {
1010 echo " $script "
1111 echo
1212 echo ' Description: Run Odoo upgrade scripts for target PostgreSQL database.'
13- echo " Syntax: $script [-c|-s|-t|-r|-u|-V|help]"
14- echo ' Example: $script -c postgres01 -h localhost -d erp -s 16.0 -n upgrade -t 17.0 -m test -l MXXXXXXXXX'
13+ echo " Syntax: $script [-c|-p|- s|-t|-r|-u|-V|help]"
14+ echo ' Example: $script -c postgres01 -p 16 - h localhost -d erp -s 16.0 -n upgrade -t 17.0 -m test -l MXXXXXXXXX'
1515 echo ' options:'
1616 echo ' -c PostgreSQL container. Defaults to ' \' ' postgres' \' ' .'
17+ echo ' -p Postgres version.'
1718 echo ' -d Current database name.'
1819 echo ' -s Current Odoo version.'
1920 echo ' -n Target database name.'
@@ -32,9 +33,10 @@ if [[ "$1" == 'help' ]]; then
3233fi
3334
3435# Process params
35- while getopts ' :c: :d: :s: :n: :t: :m: :l: :V' opt; do
36+ while getopts ' :c: :p: : d: :s: :n: :t: :m: :l: :V' opt; do
3637 case $opt in
3738 c) container=" $OPTARG " ;;
39+ p) postgres_version=" $OPTARG " ;;
3840 d) database=" $OPTARG " ;;
3941 s) odoo_version=" $OPTARG " ;;
4042 n) target_database=" $OPTARG " ;;
5557: " ${mode:= test} "
5658
5759# Verify variables
60+ [[ -z " $postgres_version " ]] && { echo ' Parameter -p|postgres version is empty.' ; exit 1; }
5861[[ -z " $database " ]] && { echo ' Parameter -d|database is empty.' ; exit 1; }
5962[[ -z " $odoo_version " ]] && { echo ' Parameter -s|current version is empty.' ; exit 1; }
6063[[ -z " $target_database " ]] && { echo ' Parameter -n|new database is empty.' ; exit 1; }
@@ -73,7 +76,7 @@ export pgpassword
7376
7477odoo-upgrade () {
7578 docker run -e PGHOST=" $pghost " -e PGUSER=" $pguser " -e PGPASSWORD=" $pgpassword " \
76- --network=" $network " mintsystem/odoo-upgrade " $@ "
79+ --network=" $network " " mintsystem/odoo-upgrade: $postgres_version " " $@ "
7780}
7881
7982echo " Run upgrade script for database $database in $mode mode."
0 commit comments