[IMP] use heredoc with variable expansion for SQL query
Convert the SQL_404_ADDONS_LIST query from a quoted string to a heredoc
without quotes (<<EOF instead of <<'EOF') to make variable expansion
explicit and consistent with other SQL blocks in the codebase.
Key difference between heredoc variants:
- <<'EOF': Literal content, no variable expansion (use for static SQL)
- <<EOF: Variables like ${FINALE_DB_NAME} are expanded (use when needed)
Also improved SQL formatting for better readability.
This commit is contained in:
@@ -40,20 +40,20 @@ echo "Base neutralized..."
|
|||||||
## List add-ons not in final version ##
|
## List add-ons not in final version ##
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
# Retrieve add-ons not available on the final Odoo version
|
SQL_404_ADDONS_LIST=$(cat <<EOF
|
||||||
SQL_404_ADDONS_LIST="
|
SELECT module_origin.name
|
||||||
SELECT module_origin.name
|
FROM ir_module_module module_origin
|
||||||
FROM ir_module_module module_origin
|
LEFT JOIN (
|
||||||
LEFT JOIN (
|
SELECT *
|
||||||
SELECT *
|
FROM dblink('dbname=${FINALE_DB_NAME}','SELECT name, shortdesc, author FROM ir_module_module')
|
||||||
FROM dblink('dbname=$FINALE_DB_NAME','SELECT name, shortdesc, author FROM ir_module_module')
|
AS tb2(name text, shortdesc text, author text)
|
||||||
AS tb2(name text, shortdesc text, author text)
|
) AS module_dest ON module_dest.name = module_origin.name
|
||||||
) AS module_dest ON module_dest.name = module_origin.name
|
WHERE (module_dest.name IS NULL)
|
||||||
|
AND (module_origin.state = 'installed')
|
||||||
WHERE (module_dest.name IS NULL) AND (module_origin.state = 'installed') AND (module_origin.author NOT IN ('Odoo S.A.', 'Lokavaluto', 'Elabore'))
|
AND (module_origin.author NOT IN ('Odoo S.A.', 'Lokavaluto', 'Elabore'))
|
||||||
ORDER BY module_origin.name
|
ORDER BY module_origin.name;
|
||||||
;
|
EOF
|
||||||
"
|
)
|
||||||
echo "Retrieve 404 addons... "
|
echo "Retrieve 404 addons... "
|
||||||
echo "SQL REQUEST = $SQL_404_ADDONS_LIST"
|
echo "SQL REQUEST = $SQL_404_ADDONS_LIST"
|
||||||
query_postgres_container "$SQL_404_ADDONS_LIST" "$DB_NAME" > 404_addons || exit 1
|
query_postgres_container "$SQL_404_ADDONS_LIST" "$DB_NAME" > 404_addons || exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user