diff --git a/db_deploy.sql b/db_deploy.sql index 18de438..5e3da01 100644 --- a/db_deploy.sql +++ b/db_deploy.sql @@ -31,21 +31,25 @@ COMMENT ON COLUMN evt.acct.prop IS 'properties'; ------------------------fiscal periods------------------------ CREATE TABLE evt.fspr ( - id ltree + id ltree PRIMARY KEY ,dur tstzrange ); COMMENT ON COLUMN evt.fspr.id IS 'fiscal period'; COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range'; - CREATE INDEX id_gist ON evt.fspr USING GIST (id); + --------------------------relational ledger------------------------------------------ CREATE TABLE evt.gl ( id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY ,bprid INT REFERENCES evt.bpr (id) ,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) ,glline INT ,bprkeys JSONB @@ -53,6 +57,9 @@ CREATE TABLE evt.gl ( 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'; +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.glline IS 'gl line number'; COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record'; diff --git a/schema/tables/fspr.sql b/schema/tables/fspr.sql index 25238fe..1fa789e 100644 --- a/schema/tables/fspr.sql +++ b/schema/tables/fspr.sql @@ -1,10 +1,9 @@ ------------------------fiscal periods------------------------ CREATE TABLE evt.fspr ( - id ltree + id ltree PRIMARY KEY ,dur tstzrange -) +); COMMENT ON COLUMN evt.fspr.id IS 'fiscal period'; COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range'; - CREATE INDEX id_gist ON evt.fspr USING GIST (id); diff --git a/schema/tables/gl.sql b/schema/tables/gl.sql index 2a055aa..da422f1 100644 --- a/schema/tables/gl.sql +++ b/schema/tables/gl.sql @@ -7,7 +7,7 @@ CREATE TABLE evt.gl ( ,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP --populates by trigger join to evt.fspr ,tstmp timestamptz - ,fspr ltree REFERENCES evt.fspr (id); + ,fspr ltree REFERENCES evt.fspr (id) ,amount numeric (12,2) ,glline INT ,bprkeys JSONB