mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
Feat[BE-261,265]: createing BOP and BOP realization(Unfinished)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user