From 8f75e8b44222c493e1dfa5279c0383adf8dc5ebf Mon Sep 17 00:00:00 2001 From: oxpoe Date: Fri, 9 Oct 2026 08:20:16 +0700 Subject: [PATCH] fix(db): buat tabel discount_logs (fresh-install) - perbaiki 500 di /admin/discounts --- config/database.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/database.js b/config/database.js index 9162252..8a79de6 100644 --- a/config/database.js +++ b/config/database.js @@ -192,6 +192,22 @@ db.exec(` created_at DATETIME DEFAULT (NOW_LOCAL()) ); + CREATE TABLE IF NOT EXISTS discount_logs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + invoice_id INTEGER, + customer_id INTEGER, + period_month INTEGER, + period_year INTEGER, + discount_type TEXT, + discount_value REAL, + discount_amount REAL, + amount_before REAL, + amount_after REAL, + applied_by TEXT DEFAULT '', + note TEXT DEFAULT '', + created_at DATETIME DEFAULT CURRENT_TIMESTAMP + ); + CREATE TABLE IF NOT EXISTS tickets ( id INTEGER PRIMARY KEY AUTOINCREMENT, customer_id INTEGER NOT NULL REFERENCES customers(id) ON DELETE CASCADE,