diff --git a/bin/upgrade-odoo b/bin/upgrade-odoo index 8d3c7d3f..5fd03162 100755 --- a/bin/upgrade-odoo +++ b/bin/upgrade-odoo @@ -227,15 +227,20 @@ upgrade-odoo() { if [[ "$2" = "rename-production" ]]; then log-warning "Run step 'rename-production' on $TARGET_SERVER." + if [[ "$POSTGRES_CONTAINER" != "$TARGET_POSTGRES_CONTAINER" ]]; then + # The database is new if [[ "$DATABASE" = "odoo" ]]; then - echo "Rename database '$DATABASE' to '${DATABASE}-old'" - $ssh_server docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$DATABASE" -t "${DATABASE}-old" - else + # Rename odoo database in the new container echo "Rename database '$DATABASE' to '${DATABASE}-old'" $ssh_server docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$DATABASE" -t "${DATABASE}-old" fi + # Rename database in the old container + echo "Rename database '$DATABASE' to '${DATABASE}-old'" + $ssh_server docker-postgres-rename -c "$POSTGRES_CONTAINER" -s "$DATABASE" -t "${DATABASE}-old" + + # Rename upgrade database in the new container echo "Rename database '$TARGET_DATABASE' to '$DATABASE'" $ssh_server docker-postgres-rename -c "$TARGET_POSTGRES_CONTAINER" -s "$TARGET_DATABASE" -t "$DATABASE" else