From 93c9eb2a453636eadc30f422966ab6dc62d70ad3 Mon Sep 17 00:00:00 2001 From: db123-test Date: Tue, 5 May 2026 11:02:45 +0330 Subject: [PATCH] refactor(db): replace cidr with ip column in audit_log table Remove the cidr column from the audit_log table schema and update all INSERT statements to use the ip column instead, aligning the field name with the actual data being stored. --- db.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db.go b/db.go index b30315e..e31ac97 100644 --- a/db.go +++ b/db.go @@ -42,7 +42,6 @@ func InitDB(dbPath string) (*sql.DB, error) { timestamp DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, action TEXT NOT NULL, ip TEXT, - cidr TEXT, ttl_seconds INTEGER, reason TEXT, api_client_ip TEXT @@ -61,7 +60,7 @@ func AddPermanentEntry(db *sql.DB, entry, apiClientIP string) (bool, error) { if err != nil { if isUniqueConstraintError(err) { _, err = db.Exec(` - INSERT INTO audit_log(action, cidr, api_client_ip) + INSERT INTO audit_log(action, ip, api_client_ip) VALUES('add_perm_duplicate', ?, ?) `, entry, apiClientIP) if err != nil { @@ -72,7 +71,7 @@ func AddPermanentEntry(db *sql.DB, entry, apiClientIP string) (bool, error) { return false, err } _, err = db.Exec(` - INSERT INTO audit_log(action, cidr, api_client_ip) + INSERT INTO audit_log(action, ip, api_client_ip) VALUES('add_perm', ?, ?) `, entry, apiClientIP) if err != nil { @@ -90,7 +89,7 @@ func DeletePermanentEntry(db *sql.DB, entry, apiClientIP string) error { return err } _, err = db.Exec(` - INSERT INTO audit_log(action, cidr, api_client_ip) + INSERT INTO audit_log(action, ip, api_client_ip) VALUES('delete_perm', ?, ?) `, entry, apiClientIP) if err != nil {