add primary key and chane column name
This commit is contained in:
parent
7e81842da8
commit
e3c0530787
@ -68,19 +68,21 @@ COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record
|
|||||||
|
|
||||||
CREATE TABLE evt.bal (
|
CREATE TABLE evt.bal (
|
||||||
acct ltree REFERENCES evt.acct(acct)
|
acct ltree REFERENCES evt.acct(acct)
|
||||||
,perd ltree REFERENCES evt.fspr(id)
|
,fspr ltree REFERENCES evt.fspr(id)
|
||||||
,obal numeric(12,2)
|
,obal numeric(12,2)
|
||||||
,debits numeric(12,2)
|
,debits numeric(12,2)
|
||||||
,credits numeric(12,2)
|
,credits numeric(12,2)
|
||||||
,cbal numeric(12,2)
|
,cbal numeric(12,2)
|
||||||
);
|
);
|
||||||
|
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
|
||||||
COMMENT ON COLUMN evt.bal.acct IS 'account';
|
COMMENT ON COLUMN evt.bal.acct IS 'account';
|
||||||
COMMENT ON COLUMN evt.bal.perd IS 'period';
|
COMMENT ON COLUMN evt.bal.fspr IS 'period';
|
||||||
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
|
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
|
||||||
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
|
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
|
||||||
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
|
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
|
||||||
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
|
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
|
||||||
|
|
||||||
|
|
||||||
---------------------------handle new logged event----------------------------------------
|
---------------------------handle new logged event----------------------------------------
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
|
CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
CREATE TABLE evt.bal (
|
CREATE TABLE evt.bal (
|
||||||
acct ltree REFERENCES evt.acct(acct)
|
acct ltree REFERENCES evt.acct(acct)
|
||||||
,perd ltree REFERENCES evt.fspr(id)
|
,fspr ltree REFERENCES evt.fspr(id)
|
||||||
,obal numeric(12,2)
|
,obal numeric(12,2)
|
||||||
,debits numeric(12,2)
|
,debits numeric(12,2)
|
||||||
,credits numeric(12,2)
|
,credits numeric(12,2)
|
||||||
,cbal numeric(12,2)
|
,cbal numeric(12,2)
|
||||||
);
|
);
|
||||||
|
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
|
||||||
COMMENT ON COLUMN evt.bal.acct IS 'account';
|
COMMENT ON COLUMN evt.bal.acct IS 'account';
|
||||||
COMMENT ON COLUMN evt.bal.perd IS 'period';
|
COMMENT ON COLUMN evt.bal.fspr IS 'period';
|
||||||
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
|
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
|
||||||
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
|
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
|
||||||
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
|
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
|
||||||
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
|
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
|
||||||
|
Loading…
Reference in New Issue
Block a user