Fix: Change 'amount' to 'price' to match database schema - Database uses 'price' column, not 'amount' - Update all queries in DailySummaryService, HourlySummaryService - Update RetribusiWriteService (SELECT, INSERT, UPDATE) - Update Validator to use 'price' field - Update check_database.php and TROUBLESHOOTING.md

This commit is contained in:
mwpn
2025-12-17 13:36:29 +07:00
parent 56403469ef
commit ca3b1bd0d7
8 changed files with 61 additions and 52 deletions

View File

@@ -2,10 +2,14 @@
## Error: "Unknown column 't.amount' in 'SELECT'"
### Kemungkinan Penyebab:
### Root Cause:
**Kolom di database adalah `price`, bukan `amount`!**
Database production menggunakan kolom `price` di tabel `tariffs`, tapi code menggunakan `amount`. Ini menyebabkan mismatch.
### Kemungkinan Penyebab Lain:
1. **OPcache belum di-clear** - PHP masih menggunakan file lama
2. **Struktur database berbeda** - Kolom `amount` mungkin tidak ada atau nama berbeda
3. **File belum ter-update** - Meskipun sudah `git pull`, file mungkin belum benar-benar ter-update
2. **File belum ter-update** - Meskipun sudah `git pull`, file mungkin belum benar-benar ter-update
---
@@ -65,7 +69,7 @@ SELECT
e.gate_code,
e.category,
COUNT(*) as total_count,
COALESCE(t.amount, 0) as tariff_amount
COALESCE(t.price, 0) as tariff_amount
FROM entry_events e
INNER JOIN locations l ON e.location_code = l.code AND l.is_active = 1
INNER JOIN gates g ON e.location_code = g.location_code
@@ -80,7 +84,7 @@ GROUP BY
e.location_code,
e.gate_code,
e.category,
COALESCE(t.amount, 0)
COALESCE(t.price, 0)
LIMIT 5;
```