Feat[BE-261,265]: createing BOP and BOP realization(Unfinished)

This commit is contained in:
aguhh18
2025-11-19 16:05:11 +07:00
parent a57ef82ebb
commit 105b20c333
18 changed files with 1279 additions and 115 deletions
@@ -1,11 +1,11 @@
CREATE TABLE expenses (
id BIGSERIAL PRIMARY KEY,
reference_number VARCHAR, -- format => BOP-LTI-0001 = 0001 is increment
reference_number VARCHAR(50) UNIQUE NOT NULL,
supplier_id BIGINT NULL,
category VARCHAR(50) NOT NULL CHECK (
category IN ('BOP', 'NON-BOP')
),
po_number VARCHAR(50) UNIQUE NOT NULL,
po_number VARCHAR(50) NULL,
document_path JSON,
expense_date DATE NOT NULL,
grand_total NUMERIC(15, 3) DEFAULT 0,
@@ -16,6 +16,8 @@ CREATE TABLE expenses (
deleted_at TIMESTAMPTZ
);
CREATE SEQUENCE expenses_ref_seq INCREMENT BY 1 START WITH 1;
-- Tambahkan Foreign Key ke suppliers
DO $$
BEGIN
@@ -23,7 +25,9 @@ BEGIN
ALTER TABLE expenses
ADD CONSTRAINT fk_expenses_supplier_id
FOREIGN KEY (supplier_id) REFERENCES suppliers(id);
END IF;
END IF;
END $$;
-- Tambahkan Foreign Key ke users (created_by)