chore: 更新建表脚本
添加关于 meta JSONB 的说明
This commit is contained in:
parent
9932e81157
commit
26933bade5
1 changed files with 25 additions and 3 deletions
|
@ -1,21 +1,43 @@
|
||||||
-- 创建账户表
|
-- 账户表
|
||||||
CREATE TABLE account (
|
CREATE TABLE account (
|
||||||
a_id SERIAL PRIMARY KEY,
|
a_id SERIAL PRIMARY KEY,
|
||||||
meta JSONB
|
meta JSONB
|
||||||
);
|
);
|
||||||
|
-- {"name":"name",
|
||||||
|
-- "balance": 0.00,
|
||||||
|
-- “budget": [
|
||||||
|
-- {"time":"2022-02","value":20.32},
|
||||||
|
-- {"time":"2022-01","value":30.32}
|
||||||
|
-- ]
|
||||||
|
-- "discription":"something"}
|
||||||
|
|
||||||
-- 创建类别表
|
-- 类别表
|
||||||
CREATE TABLE category (
|
CREATE TABLE category (
|
||||||
c_id SERIAL PRIMARY KEY,
|
c_id SERIAL PRIMARY KEY,
|
||||||
meta JSONB
|
meta JSONB
|
||||||
);
|
);
|
||||||
|
-- {"name":"name",
|
||||||
|
-- "type":"in"/"out",
|
||||||
|
-- “budget": [
|
||||||
|
-- {"time":"2022-02","value":20.32},
|
||||||
|
-- {"time":"2022-01","value":30.32}
|
||||||
|
-- ]
|
||||||
|
-- "discription":"something"}
|
||||||
|
|
||||||
-- 创建流水表
|
-- 流水表
|
||||||
CREATE TABLE transaction (
|
CREATE TABLE transaction (
|
||||||
t_id SERIAL PRIMARY KEY,
|
t_id SERIAL PRIMARY KEY,
|
||||||
c_id INTEGER REFERENCES category(c_id),
|
c_id INTEGER REFERENCES category(c_id),
|
||||||
a_id INTEGER REFERENCES account(a_id),
|
a_id INTEGER REFERENCES account(a_id),
|
||||||
meta JSONB
|
meta JSONB
|
||||||
);
|
);
|
||||||
|
-- {"discription":"something",(可选)
|
||||||
|
-- "type":"in"/"out"/"transfer",
|
||||||
|
-- "transfer_dist":a_id,(可选)
|
||||||
|
-- "reimburse":{ (报销)
|
||||||
|
-- "finish": true,
|
||||||
|
-- "ref":t_id
|
||||||
|
-- }
|
||||||
|
-- "":"something"}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue