2023-05-23 10:01:41 +00:00
|
|
|
-- 账户表
|
2023-05-21 15:00:12 +00:00
|
|
|
CREATE TABLE account (
|
|
|
|
a_id SERIAL PRIMARY KEY,
|
|
|
|
meta JSONB
|
|
|
|
);
|
2023-05-23 10:01:41 +00:00
|
|
|
-- {"name":"name",
|
|
|
|
-- "balance": 0.00,
|
|
|
|
-- “budget": [
|
|
|
|
-- {"time":"2022-02","value":20.32},
|
|
|
|
-- {"time":"2022-01","value":30.32}
|
|
|
|
-- ]
|
|
|
|
-- "discription":"something"}
|
2023-05-21 15:00:12 +00:00
|
|
|
|
2023-05-23 10:01:41 +00:00
|
|
|
-- 类别表
|
2023-05-21 15:00:12 +00:00
|
|
|
CREATE TABLE category (
|
|
|
|
c_id SERIAL PRIMARY KEY,
|
|
|
|
meta JSONB
|
|
|
|
);
|
2023-05-23 10:01:41 +00:00
|
|
|
-- {"name":"name",
|
|
|
|
-- "type":"in"/"out",
|
|
|
|
-- “budget": [
|
|
|
|
-- {"time":"2022-02","value":20.32},
|
|
|
|
-- {"time":"2022-01","value":30.32}
|
|
|
|
-- ]
|
|
|
|
-- "discription":"something"}
|
2023-05-21 15:00:12 +00:00
|
|
|
|
2023-05-23 10:01:41 +00:00
|
|
|
-- 流水表
|
2023-05-21 15:00:12 +00:00
|
|
|
CREATE TABLE transaction (
|
|
|
|
t_id SERIAL PRIMARY KEY,
|
|
|
|
c_id INTEGER REFERENCES category(c_id),
|
|
|
|
a_id INTEGER REFERENCES account(a_id),
|
|
|
|
meta JSONB
|
|
|
|
);
|
2023-05-23 10:01:41 +00:00
|
|
|
-- {"discription":"something",(可选)
|
|
|
|
-- "type":"in"/"out"/"transfer",
|
|
|
|
-- "transfer_dist":a_id,(可选)
|
|
|
|
-- "reimburse":{ (报销)
|
|
|
|
-- "finish": true,
|
|
|
|
-- "ref":t_id
|
|
|
|
-- }
|
|
|
|
-- "":"something"}
|
2023-05-21 15:00:12 +00:00
|
|
|
|
|
|
|
|