convert acct to ltree

This commit is contained in:
Paul Trowbridge 2018-09-20 22:28:24 -04:00
parent 4c6001fbf7
commit e6dc7f154b
4 changed files with 8 additions and 8 deletions

View File

@ -23,7 +23,7 @@ COMMENT ON COLUMN evt.bpr.stmp IS 'insert time';
--the account master should be dynamically created --the account master should be dynamically created
CREATE TABLE evt.acct ( CREATE TABLE evt.acct (
acct text PRIMARY KEY acct ltree PRIMARY KEY
,prop jsonb ,prop jsonb
); );
COMMENT ON COLUMN evt.acct.acct IS 'account'; COMMENT ON COLUMN evt.acct.acct IS 'account';
@ -45,7 +45,7 @@ CREATE INDEX id_gist ON evt.fspr USING GIST (id);
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 ltree REFERENCES evt.acct (acct)
,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
@ -67,8 +67,8 @@ COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record
--------------------------balances---------------------------------------------------- --------------------------balances----------------------------------------------------
CREATE TABLE evt.bal ( CREATE TABLE evt.bal (
acct TEXT REFERENCES evt.acct(acct) acct ltree REFERENCES evt.acct(acct)
,perd daterange ,perd ltree
,obal numeric(12,2) ,obal numeric(12,2)
,debits numeric(12,2) ,debits numeric(12,2)
,credits numeric(12,2) ,credits numeric(12,2)

View File

@ -2,7 +2,7 @@
--the account master should be dynamically created --the account master should be dynamically created
CREATE TABLE evt.acct ( CREATE TABLE evt.acct (
acct text PRIMARY KEY acct ltree PRIMARY KEY
,prop jsonb ,prop jsonb
); );
COMMENT ON COLUMN evt.acct.acct IS 'account'; COMMENT ON COLUMN evt.acct.acct IS 'account';

View File

@ -1,8 +1,8 @@
--------------------------balances---------------------------------------------------- --------------------------balances----------------------------------------------------
CREATE TABLE evt.bal ( CREATE TABLE evt.bal (
acct TEXT REFERENCES evt.acct(acct) acct ltree REFERENCES evt.acct(acct)
,perd daterange ,perd ltree
,obal numeric(12,2) ,obal numeric(12,2)
,debits numeric(12,2) ,debits numeric(12,2)
,credits numeric(12,2) ,credits numeric(12,2)

View File

@ -3,7 +3,7 @@
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 ltree REFERENCES evt.acct (acct)
,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