-
Notifications
You must be signed in to change notification settings - Fork 1
/
bankDB.sql
278 lines (201 loc) · 7.35 KB
/
bankDB.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
--
-- PostgreSQL database dump
--
-- Dumped from database version 16.2
-- Dumped by pg_dump version 16.0
-- Started on 2024-05-11 11:43:27
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;
--
-- TOC entry 218 (class 1259 OID 16577)
-- Name: account; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.account (
account_id integer NOT NULL,
currency character varying(10),
balance integer,
type character varying(50),
user_id integer
);
ALTER TABLE public.account OWNER TO postgres;
--
-- TOC entry 217 (class 1259 OID 16576)
-- Name: account_account_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.account_account_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.account_account_id_seq OWNER TO postgres;
--
-- TOC entry 4807 (class 0 OID 0)
-- Dependencies: 217
-- Name: account_account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.account_account_id_seq OWNED BY public.account.account_id;
--
-- TOC entry 220 (class 1259 OID 16584)
-- Name: transaction; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.transaction (
transaction_id integer NOT NULL,
date date,
amount character varying,
origin_account_id integer,
destiny_account_id integer
);
ALTER TABLE public.transaction OWNER TO postgres;
--
-- TOC entry 219 (class 1259 OID 16583)
-- Name: transaction_transaction_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.transaction_transaction_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.transaction_transaction_id_seq OWNER TO postgres;
--
-- TOC entry 4808 (class 0 OID 0)
-- Dependencies: 219
-- Name: transaction_transaction_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.transaction_transaction_id_seq OWNED BY public.transaction.transaction_id;
--
-- TOC entry 216 (class 1259 OID 16568)
-- Name: user; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public."user" (
user_id integer NOT NULL,
name character varying(255),
last_name character varying(255),
user_name character varying(255),
password character varying(255),
"isAdmin" smallint
);
ALTER TABLE public."user" OWNER TO postgres;
--
-- TOC entry 215 (class 1259 OID 16567)
-- Name: user_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.user_user_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE public.user_user_id_seq OWNER TO postgres;
--
-- TOC entry 4809 (class 0 OID 0)
-- Dependencies: 215
-- Name: user_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.user_user_id_seq OWNED BY public."user".user_id;
--
-- TOC entry 4645 (class 2604 OID 16580)
-- Name: account account_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.account ALTER COLUMN account_id SET DEFAULT nextval('public.account_account_id_seq'::regclass);
--
-- TOC entry 4646 (class 2604 OID 16587)
-- Name: transaction transaction_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transaction ALTER COLUMN transaction_id SET DEFAULT nextval('public.transaction_transaction_id_seq'::regclass);
--
-- TOC entry 4644 (class 2604 OID 16571)
-- Name: user user_id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."user" ALTER COLUMN user_id SET DEFAULT nextval('public.user_user_id_seq'::regclass);
--
-- TOC entry 4799 (class 0 OID 16577)
-- Dependencies: 218
-- Data for Name: account; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.account VALUES (2, '$', 136700, 'investment', 8);
INSERT INTO public.account VALUES (3, '$', 49300, 'savings', 10);
INSERT INTO public.account VALUES (4, 'US$', 10150, 'savings', 8);
INSERT INTO public.account VALUES (5, 'US$', 3350, 'savings', 10);
INSERT INTO public.account VALUES (7, 'US$', 0, 'investment', 9);
INSERT INTO public.account VALUES (6, '$', 15000, 'savings', 9);
INSERT INTO public.account VALUES (1, '$', 60440, 'savings', 8);
--
-- TOC entry 4801 (class 0 OID 16584)
-- Dependencies: 220
-- Data for Name: transaction; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.transaction VALUES (1, '2022-09-19', '4560', 1, 2);
INSERT INTO public.transaction VALUES (2, '2022-09-19', '18000', 1, 3);
INSERT INTO public.transaction VALUES (3, '2022-09-19', '1350', 4, 5);
INSERT INTO public.transaction VALUES (4, '2022-09-19', '200', 3, 2);
INSERT INTO public.transaction VALUES (5, '2022-09-19', '1000', 3, 2);
INSERT INTO public.transaction VALUES (6, '2022-09-19', '2000', 4, 5);
INSERT INTO public.transaction VALUES (7, '2022-09-19', '45000', 1, 3);
INSERT INTO public.transaction VALUES (8, '2022-09-26', '12000', 3, 2);
INSERT INTO public.transaction VALUES (9, '2022-09-27', '500', 3, 2);
INSERT INTO public.transaction VALUES (10, '2024-05-11', '5000', 6, 1);
--
-- TOC entry 4797 (class 0 OID 16568)
-- Dependencies: 216
-- Data for Name: user; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public."user" VALUES (1, 'ale', 'zdut', 'admin', 'admin', NULL);
INSERT INTO public."user" VALUES (2, 'ale', 'perez', 'ale', '1234', NULL);
INSERT INTO public."user" VALUES (3, 'Mario', 'Pergolini', 'mario_pergolini', '1234', NULL);
INSERT INTO public."user" VALUES (4, 'seba', 'dlh', 'root', 'password', 1);
INSERT INTO public."user" VALUES (5, 'Tomas', 'Temporelli', 'tototempo', '123456', NULL);
--
-- TOC entry 4810 (class 0 OID 0)
-- Dependencies: 217
-- Name: account_account_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.account_account_id_seq', 7, true);
--
-- TOC entry 4811 (class 0 OID 0)
-- Dependencies: 219
-- Name: transaction_transaction_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.transaction_transaction_id_seq', 10, true);
--
-- TOC entry 4812 (class 0 OID 0)
-- Dependencies: 215
-- Name: user_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.user_user_id_seq', 5, true);
--
-- TOC entry 4650 (class 2606 OID 16582)
-- Name: account account_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.account
ADD CONSTRAINT account_pkey PRIMARY KEY (account_id);
--
-- TOC entry 4652 (class 2606 OID 16591)
-- Name: transaction transaction_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.transaction
ADD CONSTRAINT transaction_pkey PRIMARY KEY (transaction_id);
--
-- TOC entry 4648 (class 2606 OID 16575)
-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public."user"
ADD CONSTRAINT user_pkey PRIMARY KEY (user_id);
-- Completed on 2024-05-11 11:43:27
--
-- PostgreSQL database dump complete
--