From 99a358c775aab5acaa28baba7d275fa63c3396b4 Mon Sep 17 00:00:00 2001
From: Johan de Klerk <johan@shiplogic.com>
Date: Tue, 3 Oct 2023 11:35:59 +0200
Subject: [PATCH] Check for nil model

---
 logs/database_logs.go | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/logs/database_logs.go b/logs/database_logs.go
index fcc0c4e..f734c23 100644
--- a/logs/database_logs.go
+++ b/logs/database_logs.go
@@ -15,6 +15,18 @@ var ignoredTableInserts = []string{
 	"communication_logs",
 	"sync_product_variants",
 	"webhook_events",
+	"notification_audit_events",
+	"rollup_age_analysis",
+	"rollup_transactions",
+	"rollup_shipments_charges",
+	"rollup_shipments_events",
+	"rollup_tripsheet",
+	"rollup_branches",
+	"cron_shipment_updates",
+	"cron_delayed_shipment_patch",
+	"orders_rollup",
+	"shipments_rollup",
+	"revenue_rollup",
 }
 
 type QueryHook struct {
@@ -56,6 +68,9 @@ func (d QueryHook) AfterQuery(_ context.Context, event *bun.QueryEvent) {
 
 func TableNameForQuery(event *bun.QueryEvent) string {
 	model := event.Model.Value()
+	if model == nil {
+		return ""
+	}
 
 	var modelObject reflect.Type
 	t := reflect.TypeOf(model)
-- 
GitLab