feat: 数据备份
This commit is contained in:
parent
40a6f7145f
commit
c5c1a1751d
1 changed files with 336 additions and 0 deletions
336
scripts/data.sql
Normal file
336
scripts/data.sql
Normal file
|
@ -0,0 +1,336 @@
|
||||||
|
--
|
||||||
|
-- PostgreSQL database dump
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Dumped from database version 15.3 (Debian 15.3-1.pgdg110+1)
|
||||||
|
-- Dumped by pg_dump version 15.3
|
||||||
|
|
||||||
|
SET statement_timeout = 0;
|
||||||
|
SET lock_timeout = 0;
|
||||||
|
SET idle_in_transaction_session_timeout = 0;
|
||||||
|
SET client_encoding = 'UTF8';
|
||||||
|
SET standard_conforming_strings = on;
|
||||||
|
SELECT pg_catalog.set_config('search_path', '', false);
|
||||||
|
SET check_function_bodies = false;
|
||||||
|
SET xmloption = content;
|
||||||
|
SET client_min_messages = warning;
|
||||||
|
SET row_security = off;
|
||||||
|
|
||||||
|
SET default_tablespace = '';
|
||||||
|
|
||||||
|
SET default_table_access_method = heap;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account; Type: TABLE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.account (
|
||||||
|
a_id integer NOT NULL,
|
||||||
|
balance money,
|
||||||
|
meta jsonb
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.account OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account_a_id_seq; Type: SEQUENCE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.account_a_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.account_a_id_seq OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account_a_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.account_a_id_seq OWNED BY public.account.a_id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category; Type: TABLE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.category (
|
||||||
|
c_id integer NOT NULL,
|
||||||
|
meta jsonb
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.category OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category_c_id_seq; Type: SEQUENCE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.category_c_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.category_c_id_seq OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category_c_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.category_c_id_seq OWNED BY public.category.c_id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction; Type: TABLE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.transaction (
|
||||||
|
t_id integer NOT NULL,
|
||||||
|
a_id integer NOT NULL,
|
||||||
|
c_id integer,
|
||||||
|
s_id integer,
|
||||||
|
"time" timestamp without time zone,
|
||||||
|
amount money,
|
||||||
|
meta jsonb
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.transaction OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction_t_id_seq; Type: SEQUENCE; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.transaction_t_id_seq
|
||||||
|
AS integer
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE public.transaction_t_id_seq OWNER TO budget;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction_t_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.transaction_t_id_seq OWNED BY public.transaction.t_id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account a_id; Type: DEFAULT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.account ALTER COLUMN a_id SET DEFAULT nextval('public.account_a_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category c_id; Type: DEFAULT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.category ALTER COLUMN c_id SET DEFAULT nextval('public.category_c_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction t_id; Type: DEFAULT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.transaction ALTER COLUMN t_id SET DEFAULT nextval('public.transaction_t_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Data for Name: account; Type: TABLE DATA; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
COPY public.account (a_id, balance, meta) FROM stdin;
|
||||||
|
4 $13,040.00 {"name": "储蓄卡(建设银行)", "description": ""}
|
||||||
|
3 $19,250.00 {"name": "工资卡(中国银行)", "description": ""}
|
||||||
|
1 $3,214.43 {"name": "微信", "description": ""}
|
||||||
|
2 $544.10 {"name": "支付宝", "description": ""}
|
||||||
|
\.
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Data for Name: category; Type: TABLE DATA; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
COPY public.category (c_id, meta) FROM stdin;
|
||||||
|
1 {"name": "饮食", "type": "out", "description": ""}
|
||||||
|
2 {"name": "水电", "type": "out", "description": ""}
|
||||||
|
3 {"name": "娱乐", "type": "out", "description": ""}
|
||||||
|
4 {"name": "学习", "type": "out", "description": ""}
|
||||||
|
5 {"name": "工资", "type": "in", "description": ""}
|
||||||
|
6 {"name": "理财", "type": "in", "description": ""}
|
||||||
|
7 {"name": "水电", "type": "out", "description": "低消费"}
|
||||||
|
8 {"name": "医疗", "type": "out", "description": ""}
|
||||||
|
9 {"name": "交通", "type": "out", "description": ""}
|
||||||
|
10 {"name": "购物", "type": "out", "description": ""}
|
||||||
|
\.
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Data for Name: transaction; Type: TABLE DATA; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
COPY public.transaction (t_id, a_id, c_id, s_id, "time", amount, meta) FROM stdin;
|
||||||
|
5 1 1 \N 2023-06-04 14:14:52.541843 -$32.75 {"type": "out", "description": ""}
|
||||||
|
6 2 1 \N 2023-06-04 14:15:03.209135 -$73.20 {"type": "out", "description": ""}
|
||||||
|
7 1 1 \N 2023-06-04 14:15:14.321607 -$57.92 {"type": "out", "description": ""}
|
||||||
|
8 1 2 \N 2023-06-04 14:15:23.770381 -$235.00 {"type": "out", "description": ""}
|
||||||
|
1 1 \N \N 2023-02-04 14:13:06 $3,000.00 {"type": "init", "description": "Initial Balance"}
|
||||||
|
2 2 \N \N 2023-02-04 14:13:22 $600.00 {"type": "init", "description": "Initial Balance"}
|
||||||
|
3 3 \N \N 2023-02-04 14:13:34 $4,000.00 {"type": "init", "description": "Initial Balance"}
|
||||||
|
4 4 \N \N 2023-02-04 14:13:58 $7,000.00 {"type": "init", "description": "Initial Balance"}
|
||||||
|
38 2 7 \N 2023-05-07 19:55:43 -$60.00 {"type": "out", "description": ""}
|
||||||
|
39 2 4 \N 2023-05-06 19:55:59 -$60.00 {"type": "out", "description": ""}
|
||||||
|
9 1 2 \N 2023-05-15 14:15:31 -$235.00 {"type": "out", "description": "电费过多"}
|
||||||
|
10 2 3 \N 2023-06-04 14:36:54.760977 -$50.00 {"type": "out", "description": ""}
|
||||||
|
12 1 6 \N 2023-06-04 14:37:24.994996 $3,000.00 {"type": "in", "description": ""}
|
||||||
|
11 3 5 \N 2023-06-04 14:37:15 $5,000.00 {"type": "in", "description": "主要工资"}
|
||||||
|
13 1 1 \N 2023-06-03 19:11:36 -$200.00 {"type": "out", "description": ""}
|
||||||
|
14 1 2 \N 2023-06-02 19:12:13 -$20.00 {"type": "out", "description": ""}
|
||||||
|
15 2 3 \N 2023-06-01 19:12:49 -$300.00 {"type": "out", "description": ""}
|
||||||
|
16 2 4 \N 2023-05-04 19:14:01 -$20.00 {"type": "out", "description": ""}
|
||||||
|
17 4 5 \N 2023-05-04 19:14:45 $5,000.00 {"type": "in", "description": ""}
|
||||||
|
18 3 5 \N 2023-05-05 19:15:49 $5,000.00 {"type": "in", "description": ""}
|
||||||
|
21 2 6 \N 2023-05-04 19:18:04 $500.00 {"type": "in", "description": ""}
|
||||||
|
23 3 6 \N 2023-06-03 19:19:09 $300.00 {"type": "in", "description": ""}
|
||||||
|
24 4 6 \N 2023-05-03 19:19:39 $500.00 {"type": "in", "description": ""}
|
||||||
|
25 1 4 \N 2023-05-03 19:20:39 -$50.00 {"type": "out", "description": ""}
|
||||||
|
26 3 1 \N 2023-05-04 19:48:58 -$50.00 {"type": "out", "description": ""}
|
||||||
|
27 1 2 \N 2023-05-03 19:49:15 -$60.00 {"type": "out", "description": ""}
|
||||||
|
28 1 3 \N 2023-05-02 19:49:34 -$60.00 {"type": "out", "description": ""}
|
||||||
|
29 4 3 \N 2023-05-01 19:49:53 -$60.00 {"type": "out", "description": ""}
|
||||||
|
30 1 4 \N 2023-05-06 19:50:13 -$50.00 {"type": "out", "description": ""}
|
||||||
|
31 2 4 \N 2023-05-05 19:50:36 -$50.00 {"type": "out", "description": ""}
|
||||||
|
32 1 7 \N 2023-05-07 19:51:01 -$20.00 {"type": "out", "description": ""}
|
||||||
|
33 2 7 \N 2023-05-08 19:51:28 -$30.00 {"type": "out", "description": ""}
|
||||||
|
34 4 6 \N 2023-05-07 19:51:47 $600.00 {"type": "in", "description": ""}
|
||||||
|
35 2 1 \N 2023-05-07 19:53:29 -$60.00 {"type": "out", "description": ""}
|
||||||
|
36 2 3 \N 2023-05-04 19:53:44 -$80.00 {"type": "out", "description": ""}
|
||||||
|
37 1 4 \N 2023-05-04 19:53:59 -$50.00 {"type": "out", "description": ""}
|
||||||
|
40 1 1 \N 2023-05-01 19:56:13 -$300.00 {"type": "out", "description": ""}
|
||||||
|
41 1 3 \N 2023-05-03 19:56:40 -$60.00 {"type": "out", "description": ""}
|
||||||
|
42 1 1 \N 2023-05-04 19:56:58 -$500.00 {"type": "out", "description": ""}
|
||||||
|
43 1 4 \N 2023-05-08 19:57:13 -$50.00 {"type": "out", "description": ""}
|
||||||
|
44 1 1 \N 2023-05-08 19:57:35 -$50.00 {"type": "out", "description": ""}
|
||||||
|
45 1 2 \N 2023-05-08 19:57:47 -$50.00 {"type": "out", "description": ""}
|
||||||
|
46 2 3 \N 2023-05-08 19:58:54 -$60.00 {"type": "out", "description": ""}
|
||||||
|
47 1 6 \N 2023-05-08 19:59:13 $500.00 {"type": "in", "description": ""}
|
||||||
|
48 1 2 \N 2023-05-08 19:59:35 -$800.00 {"type": "out", "description": ""}
|
||||||
|
49 1 4 \N 2023-05-07 19:59:47 -$60.00 {"type": "out", "description": ""}
|
||||||
|
50 3 5 \N 2023-06-04 20:00:04.350207 $5,000.00 {"type": "in", "description": ""}
|
||||||
|
51 2 1 \N 2023-05-07 20:00:30 -$90.00 {"type": "out", "description": ""}
|
||||||
|
52 1 1 \N 2023-06-05 15:30:32.26733 -$8.00 {"type": "out", "description": "水果"}
|
||||||
|
53 1 4 \N 2023-06-05 15:38:53.417778 -$2.90 {"type": "out", "description": "打印作业"}
|
||||||
|
54 1 1 \N 2023-06-03 15:40:01 -$9.00 {"type": "out", "description": "奶茶"}
|
||||||
|
55 2 10 \N 2023-06-05 15:48:41.416907 -$134.00 {"type": "out", "description": "水杯"}
|
||||||
|
56 2 10 \N 2023-06-05 15:49:19.312522 -$39.90 {"type": "out", "description": "纸巾"}
|
||||||
|
57 2 10 \N 2023-06-05 15:49:55.757227 -$56.80 {"type": "out", "description": "仓鼠笼子"}
|
||||||
|
59 1 1 \N 2023-06-03 15:50:51 -$18.00 {"type": "out", "description": "晚餐"}
|
||||||
|
58 1 1 \N 2023-06-03 15:50:33 -$15.00 {"type": "out", "description": "午餐"}
|
||||||
|
60 2 9 \N 2023-06-04 15:51:39 -$4.00 {"type": "out", "description": "地铁"}
|
||||||
|
61 1 9 \N 2023-06-04 15:52:07 -$11.00 {"type": "out", "description": "打车"}
|
||||||
|
62 1 1 \N 2023-06-04 15:52:44 -$21.00 {"type": "out", "description": "午餐"}
|
||||||
|
64 1 1 \N 2023-06-04 15:53:29 -$10.00 {"type": "out", "description": "水果"}
|
||||||
|
63 1 1 \N 2023-06-04 15:53:11 -$19.00 {"type": "out", "description": "晚餐"}
|
||||||
|
65 2 9 \N 2023-04-05 15:54:54 -$58.00 {"type": "out", "description": "动车"}
|
||||||
|
66 1 9 \N 2023-04-06 15:55:25 -$58.00 {"type": "out", "description": "动车"}
|
||||||
|
67 1 7 \N 2023-06-02 15:56:39 -$100.00 {"type": "out", "description": "充水卡"}
|
||||||
|
68 1 5 \N 2023-06-01 15:57:33 $1,000.00 {"type": "in", "description": "生活费"}
|
||||||
|
69 1 1 \N 2023-06-01 15:59:30 -$57.00 {"type": "out", "description": "火锅"}
|
||||||
|
70 1 10 \N 2023-05-07 16:01:31 -$339.00 {"type": "out", "description": "鞋子"}
|
||||||
|
71 1 3 \N 2023-05-06 16:02:10 -$168.00 {"type": "out", "description": "打麻将"}
|
||||||
|
72 1 1 \N 2023-05-19 16:03:41 -$90.00 {"type": "out", "description": "吃小龙虾"}
|
||||||
|
73 1 3 \N 2023-04-13 16:04:37 -$19.00 {"type": "out", "description": "知乎会员"}
|
||||||
|
74 2 \N 1 2023-06-05 18:29:39.788525 $200.00 {"type": "transfer", "description": "Transfer"}
|
||||||
|
19 2 7 \N 2023-06-04 19:16:57 -$30.00 {"type": "out", "description": ""}
|
||||||
|
22 1 1 \N 2023-06-03 19:18:31 -$200.00 {"type": "out", "description": ""}
|
||||||
|
20 2 6 \N 2023-06-01 19:17:22 $500.00 {"type": "in", "description": ""}
|
||||||
|
\.
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account_a_id_seq; Type: SEQUENCE SET; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT pg_catalog.setval('public.account_a_id_seq', 4, true);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category_c_id_seq; Type: SEQUENCE SET; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT pg_catalog.setval('public.category_c_id_seq', 10, true);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction_t_id_seq; Type: SEQUENCE SET; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT pg_catalog.setval('public.transaction_t_id_seq', 74, true);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: account account_pkey; Type: CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.account
|
||||||
|
ADD CONSTRAINT account_pkey PRIMARY KEY (a_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: category category_pkey; Type: CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.category
|
||||||
|
ADD CONSTRAINT category_pkey PRIMARY KEY (c_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction transaction_pkey; Type: CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.transaction
|
||||||
|
ADD CONSTRAINT transaction_pkey PRIMARY KEY (t_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction transaction_a_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.transaction
|
||||||
|
ADD CONSTRAINT transaction_a_id_fkey FOREIGN KEY (a_id) REFERENCES public.account(a_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction transaction_c_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.transaction
|
||||||
|
ADD CONSTRAINT transaction_c_id_fkey FOREIGN KEY (c_id) REFERENCES public.category(c_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: transaction transaction_s_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: budget
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.transaction
|
||||||
|
ADD CONSTRAINT transaction_s_id_fkey FOREIGN KEY (s_id) REFERENCES public.account(a_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- PostgreSQL database dump complete
|
||||||
|
--
|
||||||
|
|
Loading…
Reference in a new issue