From 26933bade585a689cf4fe753e5e729b889690bba Mon Sep 17 00:00:00 2001 From: iridiumR Date: Tue, 23 May 2023 18:01:41 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=BB=BA=E8=A1=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加关于 meta JSONB 的说明 --- scripts/create_table.sql | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/create_table.sql b/scripts/create_table.sql index 2aae1cf..b5aa279 100644 --- a/scripts/create_table.sql +++ b/scripts/create_table.sql @@ -1,21 +1,43 @@ --- 创建账户表 +-- 账户表 CREATE TABLE account ( a_id SERIAL PRIMARY KEY, 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 ( c_id SERIAL PRIMARY KEY, 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 ( t_id SERIAL PRIMARY KEY, c_id INTEGER REFERENCES category(c_id), a_id INTEGER REFERENCES account(a_id), meta JSONB ); +-- {"discription":"something",(可选) +-- "type":"in"/"out"/"transfer", +-- "transfer_dist":a_id,(可选) +-- "reimburse":{ (报销) +-- "finish": true, +-- "ref":t_id +-- } +-- "":"something"}