mirror of
https://origin.cursor.com/mrdevmx/panels.git
synced 2026-10-09 12:03:17 +00:00
warehouse_movements no tiene project_id; el ejecutado semanal se suma por warehouses.project_id. El ejecutado por partida ya no se duplica al cruzar varias semanas. Verificado en Postgres con las cuatro lecturas de la pantalla (get, concepts, partidas, vs-cost). Co-authored-by: alberto.martinez <alberto.martinez@mrdev.mx>
30 lines
1.1 KiB
Bash
Executable file
30 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Corre las 4 RPCs de carga de Programa de obra contra Postgres local.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
PSQL="${PSQL:-psql}"
|
|
URL="${1:-}"
|
|
|
|
if [[ -z "$URL" ]]; then
|
|
echo "uso: $0 postgresql://user@host:port/db" >&2
|
|
exit 2
|
|
fi
|
|
|
|
TMP="$(mktemp /tmp/wp-load-XXXXXX.sql)"
|
|
{
|
|
cat "$ROOT/scripts/verify-work-program-load.sql"
|
|
sed -n '/^CREATE OR REPLACE FUNCTION core.fn_work_program_list_concepts/,/^\$\$;$/p' \
|
|
"$ROOT/db/core/changesets/030-rpc-work-program.sql"
|
|
sed -n '/^CREATE OR REPLACE FUNCTION core.fn_work_program_list_partidas/,/^\$\$;$/p' \
|
|
"$ROOT/db/core/changesets/030-rpc-work-program.sql"
|
|
sed -n '/^CREATE OR REPLACE FUNCTION core.fn_work_program_get/,/^\$\$;$/p' \
|
|
"$ROOT/db/core/changesets/037-fn-work-program-get-curve-vrow.sql"
|
|
sed -n '/^CREATE OR REPLACE FUNCTION core.fn_work_program_vs_cost/,/^\$\$;$/p' \
|
|
"$ROOT/db/core/changesets/038-fn-work-program-vs-cost.sql"
|
|
cat "$ROOT/scripts/verify-work-program-load-seed.sql"
|
|
} > "$TMP"
|
|
chmod 644 "$TMP"
|
|
|
|
"$PSQL" "$URL" -v ON_ERROR_STOP=1 -f "$TMP"
|
|
rm -f "$TMP"
|
|
echo "verify-work-program-load: OK"
|