some cleanup and modify gl columns

This commit is contained in:
Paul Trowbridge 2018-09-20 20:16:32 -04:00
parent a487b12b38
commit f96a540210
3 changed files with 12 additions and 6 deletions

View File

@ -31,21 +31,25 @@ COMMENT ON COLUMN evt.acct.prop IS 'properties';
------------------------fiscal periods------------------------ ------------------------fiscal periods------------------------
CREATE TABLE evt.fspr ( CREATE TABLE evt.fspr (
id ltree id ltree PRIMARY KEY
,dur tstzrange ,dur tstzrange
); );
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';
CREATE INDEX id_gist ON evt.fspr USING GIST (id); CREATE INDEX id_gist ON evt.fspr USING GIST (id);
--------------------------relational ledger------------------------------------------ --------------------------relational ledger------------------------------------------
CREATE TABLE evt.gl ( CREATE TABLE evt.gl (
id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY
,bprid INT REFERENCES evt.bpr (id) ,bprid INT REFERENCES evt.bpr (id)
,acct text REFERENCES evt.acct (acct) ,acct text REFERENCES evt.acct (acct)
,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP
--populates by trigger join to evt.fspr
,tstmp timestamptz
,fspr ltree REFERENCES evt.fspr (id)
,amount numeric (12,2) ,amount numeric (12,2)
,glline INT ,glline INT
,bprkeys JSONB ,bprkeys JSONB
@ -53,6 +57,9 @@ CREATE TABLE evt.gl (
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';
COMMENT ON COLUMN evt.gl.pstmp IS 'post time stamp';
COMMENT ON COLUMN evt.gl.tstmp IS 'transaction time stamp';
COMMENT ON COLUMN evt.gl.fspr IS 'fiscal period';
COMMENT ON COLUMN evt.gl.amount IS 'amount'; COMMENT ON COLUMN evt.gl.amount IS 'amount';
COMMENT ON COLUMN evt.gl.glline IS 'gl line number'; COMMENT ON COLUMN evt.gl.glline IS 'gl line number';
COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record'; COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record';

View File

@ -1,10 +1,9 @@
------------------------fiscal periods------------------------ ------------------------fiscal periods------------------------
CREATE TABLE evt.fspr ( CREATE TABLE evt.fspr (
id ltree id ltree PRIMARY KEY
,dur tstzrange ,dur tstzrange
) );
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';
CREATE INDEX id_gist ON evt.fspr USING GIST (id); CREATE INDEX id_gist ON evt.fspr USING GIST (id);

View File

@ -7,7 +7,7 @@ CREATE TABLE evt.gl (
,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP ,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP
--populates by trigger join to evt.fspr --populates by trigger join to evt.fspr
,tstmp timestamptz ,tstmp timestamptz
,fspr ltree REFERENCES evt.fspr (id); ,fspr ltree REFERENCES evt.fspr (id)
,amount numeric (12,2) ,amount numeric (12,2)
,glline INT ,glline INT
,bprkeys JSONB ,bprkeys JSONB