Fix: Remove created_at/updated_at from daily/hourly summary INSERT - Production database doesn't have these columns - Update DailySummaryService and HourlySummaryService - Add daily_summary and hourly_summary structure check to check_database.php

This commit is contained in:
mwpn
2025-12-17 13:38:36 +07:00
parent cb42557fa2
commit b10d590649
3 changed files with 35 additions and 9 deletions

View File

@@ -68,14 +68,14 @@ class DailySummaryService
$rowsProcessed = 0;
// Upsert to daily_summary
// Note: Table may not have created_at/updated_at columns
$upsertSql = "
INSERT INTO daily_summary
(summary_date, location_code, gate_code, category, total_count, total_amount, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, NOW(), NOW())
(summary_date, location_code, gate_code, category, total_count, total_amount)
VALUES (?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
total_count = VALUES(total_count),
total_amount = VALUES(total_amount),
updated_at = NOW()
total_amount = VALUES(total_amount)
";
$upsertStmt = $this->db->prepare($upsertSql);

View File

@@ -71,14 +71,14 @@ class HourlySummaryService
$rowsProcessed = 0;
// Upsert to hourly_summary
// Note: Table may not have created_at/updated_at columns
$upsertSql = "
INSERT INTO hourly_summary
(summary_date, summary_hour, location_code, gate_code, category, total_count, total_amount, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, NOW(), NOW())
(summary_date, summary_hour, location_code, gate_code, category, total_count, total_amount)
VALUES (?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
total_count = VALUES(total_count),
total_amount = VALUES(total_amount),
updated_at = NOW()
total_amount = VALUES(total_amount)
";
$upsertStmt = $this->db->prepare($upsertSql);