bmc_hub/scripts/debug_bmc_subs.sh

37 lines
957 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# Debug: Check BMC Office subscriptions on prod
echo "🔍 Tjekker BMC Office abonnementer på prod..."
echo ""
ssh bmcadmin@172.16.31.183 << 'ENDSSH'
echo "📊 Tabel statistik:"
podman exec bmc-hub-postgres-prod psql -U bmc_hub -d bmc_hub -c "
SELECT COUNT(*) as total_rows FROM bmc_office_subscriptions;
"
echo ""
echo "📊 Hvis der er data - vis sample:"
podman exec bmc-hub-postgres-prod psql -U bmc_hub -d bmc_hub -c "
SELECT id, customer_id, firma_name, text, active
FROM bmc_office_subscriptions
LIMIT 5;
"
echo ""
echo "📊 Customer name matching check:"
podman exec bmc-hub-postgres-prod psql -U bmc_hub -d bmc_hub -c "
SELECT
c.id,
c.name,
COUNT(bos.id) as subscription_count
FROM customers c
LEFT JOIN bmc_office_subscriptions bos ON bos.customer_id = c.id
WHERE c.name LIKE '%Mate%'
GROUP BY c.id, c.name;
"
ENDSSH
echo ""
echo "✅ Færdig"