oms-Billing/Admin/Install/db.psql.sql
Dennis Eichhorn 0722a5dea0
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled
fix permissions
2025-04-02 14:15:04 +00:00

17 lines
454 B
PL/PgSQL

CREATE SEQUENCE billing_bill_sequence;
CREATE OR REPLACE FUNCTION update_billing_bill_sequence()
RETURNS TRIGGER AS
$$
BEGIN
NEW.billing_bill_sequence = nextval('billing_bill_sequence') WHERE billing_bill_unit = NEW.billing_bill_unit;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
CREATE TRIGGER update_sequence_trigger
BEFORE INSERT ON billing_bill
FOR EACH ROW
EXECUTE FUNCTION update_billing_bill_sequence();