Merge pull request #2 from fleetside72/descr

add descriptions
This commit is contained in:
fleetside72 2018-09-27 12:50:24 -04:00 committed by GitHub
commit 6ff928e9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 6 deletions

View File

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

View File

@ -123,3 +123,5 @@ BEGIN
t.fspr = f.id;
END;
$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
,prop jsonb
);
COMMENT ON TABLE evt.acct IS 'account master list';
COMMENT ON COLUMN evt.acct.acct IS 'account';
COMMENT ON COLUMN evt.acct.prop IS 'properties';

View File

@ -10,6 +10,7 @@ CREATE TABLE evt.bal (
,prop jsonb
);
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.fspr IS 'period';
COMMENT ON COLUMN evt.bal.obal IS 'opening balance';

View File

@ -6,6 +6,7 @@ CREATE TABLE evt.bpr (
,bprh JSONB
,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.bprh IS 'basic pecuniary record history';
COMMENT ON COLUMN evt.bpr.bprh IS 'history';
COMMENT ON COLUMN evt.bpr.stmp IS 'insert time';

View File

@ -4,7 +4,7 @@ CREATE TABLE evt.fspr (
,dur tstzrange
,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.dur IS 'duration of period as timestamp range';
COMMENT ON COLUMN evt.fspr.prop IS 'period properties';

View File

@ -12,6 +12,7 @@ CREATE TABLE evt.gl (
,glline INT
,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.bprid IS 'id of initial basic pecuniary record';
COMMENT ON COLUMN evt.gl.acct IS 'account code';

View File

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

View File

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