add descriptions

This commit is contained in:
Paul Trowbridge 2018-09-27 12:49:12 -04:00
parent 18249c6b76
commit ae638af062
9 changed files with 24 additions and 6 deletions

View File

@ -15,6 +15,7 @@ CREATE TABLE evt.bpr (
,bprh JSONB ,bprh JSONB
,stmp timestamptz ,stmp timestamptz
); );
COMMENT ON TABLE evt.bpr IS 'log of events';
COMMENT ON COLUMN evt.bpr.bpr IS 'basic pecuniary record'; COMMENT ON COLUMN evt.bpr.bpr IS 'basic pecuniary record';
COMMENT ON COLUMN evt.bpr.bprh IS 'basic pecuniary record history'; COMMENT ON COLUMN evt.bpr.bprh IS 'basic pecuniary record history';
COMMENT ON COLUMN evt.bpr.stmp IS 'insert time'; COMMENT ON COLUMN evt.bpr.stmp IS 'insert time';
@ -26,6 +27,7 @@ CREATE TABLE evt.acct (
acct ltree PRIMARY KEY acct ltree PRIMARY KEY
,prop jsonb ,prop jsonb
); );
COMMENT ON TABLE evt.acct IS 'account master list';
COMMENT ON COLUMN evt.acct.acct IS 'account'; COMMENT ON COLUMN evt.acct.acct IS 'account';
COMMENT ON COLUMN evt.acct.prop IS 'properties'; COMMENT ON COLUMN evt.acct.prop IS 'properties';
@ -35,7 +37,7 @@ CREATE TABLE evt.fspr (
,dur tstzrange ,dur tstzrange
,prop jsonb ,prop jsonb
); );
COMMENT ON TABLE evt.fspr IS 'fiscal period definitions';
COMMENT ON COLUMN evt.fspr.id IS 'fiscal period'; COMMENT ON COLUMN evt.fspr.id IS 'fiscal period';
COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range'; COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range';
COMMENT ON COLUMN evt.fspr.prop IS 'period properties'; COMMENT ON COLUMN evt.fspr.prop IS 'period properties';
@ -57,6 +59,7 @@ CREATE TABLE evt.gl (
,glline INT ,glline INT
,bprkeys JSONB ,bprkeys JSONB
); );
COMMENT ON TABLE evt.gl IS 'double entry bpr perspective';
COMMENT ON COLUMN evt.gl.id IS 'gl id'; COMMENT ON COLUMN evt.gl.id IS 'gl id';
COMMENT ON COLUMN evt.gl.bprid IS 'id of initial basic pecuniary record'; COMMENT ON COLUMN evt.gl.bprid IS 'id of initial basic pecuniary record';
COMMENT ON COLUMN evt.gl.acct IS 'account code'; COMMENT ON COLUMN evt.gl.acct IS 'account code';
@ -78,6 +81,7 @@ CREATE TABLE evt.bal (
,cbal numeric(12,2) ,cbal numeric(12,2)
,prop jsonb ,prop jsonb
); );
COMMENT ON TABLE evt.bal IS 'account balances by fiscal period';
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr); 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.fspr IS 'period'; COMMENT ON COLUMN evt.bal.fspr IS 'period';
@ -165,7 +169,8 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
RETURN NULL; RETURN NULL;
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.log_insert IS 'add rows to relevant perspectives for new bpr';
CREATE TRIGGER log_insert CREATE TRIGGER log_insert
AFTER INSERT ON evt.bpr AFTER INSERT ON evt.bpr
@ -308,6 +313,8 @@ BEGIN
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.gl_insert IS 'update evt.bal with new ledger rows';
CREATE TRIGGER gl_insert CREATE TRIGGER gl_insert
AFTER INSERT ON evt.gl AFTER INSERT ON evt.gl
REFERENCING NEW TABLE AS ins REFERENCING NEW TABLE AS ins
@ -443,6 +450,8 @@ BEGIN
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.balrf() IS 'close any gaps and ensure all accounts roll forward';
------------------------json concetenate aggregate------------------------------------------- ------------------------json concetenate aggregate-------------------------------------------
CREATE OR REPLACE FUNCTION evt.jsonb_concat( CREATE OR REPLACE FUNCTION evt.jsonb_concat(

View File

@ -122,4 +122,6 @@ BEGIN
WHERE WHERE
t.fspr = f.id; t.fspr = f.id;
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.balrf() IS 'close any gaps and ensure all accounts roll forward';

View File

@ -5,5 +5,6 @@ CREATE TABLE evt.acct (
acct ltree PRIMARY KEY acct ltree PRIMARY KEY
,prop jsonb ,prop jsonb
); );
COMMENT ON TABLE evt.acct IS 'account master list';
COMMENT ON COLUMN evt.acct.acct IS 'account'; COMMENT ON COLUMN evt.acct.acct IS 'account';
COMMENT ON COLUMN evt.acct.prop IS 'properties'; COMMENT ON COLUMN evt.acct.prop IS 'properties';

View File

@ -10,6 +10,7 @@ CREATE TABLE evt.bal (
,prop jsonb ,prop jsonb
); );
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr); ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
COMMENT ON TABLE evt.bal IS 'account balances by fiscal period';
COMMENT ON COLUMN evt.bal.acct IS 'account'; COMMENT ON COLUMN evt.bal.acct IS 'account';
COMMENT ON COLUMN evt.bal.fspr 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';

View File

@ -6,6 +6,7 @@ CREATE TABLE evt.bpr (
,bprh JSONB ,bprh JSONB
,stmp timestamptz ,stmp timestamptz
); );
COMMENT ON TABLE evt.bpr IS 'log of events';
COMMENT ON COLUMN evt.bpr.bpr IS 'basic pecuniary record'; COMMENT ON COLUMN evt.bpr.bpr IS 'basic pecuniary record';
COMMENT ON COLUMN evt.bpr.bprh IS 'basic pecuniary record history'; COMMENT ON COLUMN evt.bpr.bprh IS 'history';
COMMENT ON COLUMN evt.bpr.stmp IS 'insert time'; COMMENT ON COLUMN evt.bpr.stmp IS 'insert time';

View File

@ -4,7 +4,7 @@ CREATE TABLE evt.fspr (
,dur tstzrange ,dur tstzrange
,prop jsonb ,prop jsonb
); );
COMMENT ON TABLE evt.fspr IS 'fiscal period definitions';
COMMENT ON COLUMN evt.fspr.id IS 'fiscal period'; COMMENT ON COLUMN evt.fspr.id IS 'fiscal period';
COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range'; COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range';
COMMENT ON COLUMN evt.fspr.prop IS 'period properties'; COMMENT ON COLUMN evt.fspr.prop IS 'period properties';

View File

@ -12,6 +12,7 @@ CREATE TABLE evt.gl (
,glline INT ,glline INT
,bprkeys JSONB ,bprkeys JSONB
); );
COMMENT ON TABLE evt.gl IS 'double entry bpr perspective';
COMMENT ON COLUMN evt.gl.id IS 'gl id'; COMMENT ON COLUMN evt.gl.id IS 'gl id';
COMMENT ON COLUMN evt.gl.bprid IS 'id of initial basic pecuniary record'; COMMENT ON COLUMN evt.gl.bprid IS 'id of initial basic pecuniary record';
COMMENT ON COLUMN evt.gl.acct IS 'account code'; COMMENT ON COLUMN evt.gl.acct IS 'account code';

View File

@ -133,6 +133,8 @@ BEGIN
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.gl_insert IS 'update evt.bal with new ledger rows';
CREATE TRIGGER gl_insert CREATE TRIGGER gl_insert
AFTER INSERT ON evt.gl AFTER INSERT ON evt.gl
REFERENCING NEW TABLE AS ins REFERENCING NEW TABLE AS ins

View File

@ -76,6 +76,7 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
END; END;
$func$; $func$;
COMMENT ON FUNCTION evt.log_insert IS 'add rows to relevant perspectives for new bpr';
CREATE TRIGGER log_insert CREATE TRIGGER log_insert
AFTER INSERT ON evt.bpr AFTER INSERT ON evt.bpr