2018-09-12 14:48:59 -04:00
|
|
|
--------------------------account master---------------------------------------------
|
|
|
|
|
|
|
|
--the account master should be dynamically created
|
|
|
|
CREATE TABLE evt.acct (
|
2018-09-20 22:28:24 -04:00
|
|
|
acct ltree PRIMARY KEY
|
2018-09-12 14:48:59 -04:00
|
|
|
,prop jsonb
|
|
|
|
);
|
2018-09-27 12:49:12 -04:00
|
|
|
COMMENT ON TABLE evt.acct IS 'account master list';
|
2018-09-12 14:48:59 -04:00
|
|
|
COMMENT ON COLUMN evt.acct.acct IS 'account';
|
2018-09-27 12:49:12 -04:00
|
|
|
COMMENT ON COLUMN evt.acct.prop IS 'properties';
|
2018-10-05 14:31:36 -04:00
|
|
|
|
|
|
|
--this should effectively only allow one instance of an account where retained_earnings = set per top level account (trial balance)
|
|
|
|
CREATE UNIQUE INDEX acct_re ON evt.acct (subpath(acct,0,1)) WHERE prop ->> 'retained_earnings' = 'set';
|