add properties

This commit is contained in:
Paul Trowbridge 2018-09-21 00:38:49 -04:00
parent 87d9bf537c
commit 328dc89848
4 changed files with 10 additions and 1 deletions

View File

@ -33,13 +33,16 @@ COMMENT ON COLUMN evt.acct.prop IS 'properties';
CREATE TABLE evt.fspr (
id ltree PRIMARY KEY
,dur tstzrange
,prop jsonb
);
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';
CREATE INDEX id_gist ON evt.fspr USING GIST (id);
--------------------------relational ledger------------------------------------------
CREATE TABLE evt.gl (
@ -73,6 +76,7 @@ CREATE TABLE evt.bal (
,debits numeric(12,2)
,credits numeric(12,2)
,cbal numeric(12,2)
,prop jsonb
);
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
COMMENT ON COLUMN evt.bal.acct IS 'account';
@ -81,6 +85,7 @@ COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
COMMENT ON COLUMN evt.bal.prop IS 'json of period properties';
---------------------------handle new logged event----------------------------------------

View File

@ -14,7 +14,7 @@ startm AS (
)
--select * from m
INSERT INTO
evt.fspr
evt.fspr (id, dur)
SELECT
--TO_CHAR(gs.d,'YYYY.MM.DD')::ltree t1
(

View File

@ -7,6 +7,7 @@ CREATE TABLE evt.bal (
,debits numeric(12,2)
,credits numeric(12,2)
,cbal numeric(12,2)
,prop jsonb
);
ALTER TABLE evt.bal ADD CONSTRAINT bal_pk PRIMARY KEY(acct,fspr);
COMMENT ON COLUMN evt.bal.acct IS 'account';
@ -15,3 +16,4 @@ COMMENT ON COLUMN evt.bal.obal IS 'opening balance';
COMMENT ON COLUMN evt.bal.debits IS 'total debits';
COMMENT ON COLUMN evt.bal.credits IS 'total credits';
COMMENT ON COLUMN evt.bal.cbal IS 'closing balance';
COMMENT ON COLUMN evt.bal.prop IS 'json of period properties';

View File

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