-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathinit.sql
27 lines (23 loc) · 899 Bytes
/
init.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
SHOW MAX_CONNECTIONS;
ALTER SYSTEM SET max_connections = 230;
CREATE TABLE public.cliente (
id int4 NOT NULL,
limite int4 NOT NULL,
saldo int4 NOT NULL,
CONSTRAINT cliente_pkey PRIMARY KEY (id)
);
CREATE TABLE public.transacao (
cliente_id int4 NULL,
id serial4 NOT NULL,
tipo bpchar(1) NOT NULL,
valor int4 NOT NULL,
criado_em timestamptz(6) NULL,
descricao varchar(10) NOT NULL,
CONSTRAINT transacao_pkey PRIMARY KEY (id)
);
ALTER TABLE public.transacao ADD CONSTRAINT transacao_cliente_fk FOREIGN KEY (cliente_id) REFERENCES public.cliente(id);
INSERT INTO public.cliente(id, limite, saldo)VALUES(1, 100000, 0);
INSERT INTO public.cliente(id, limite, saldo)VALUES(2, 80000, 0);
INSERT INTO public.cliente(id, limite, saldo)VALUES(3, 1000000, 0);
INSERT INTO public.cliente(id, limite, saldo)VALUES(4, 10000000, 0);
INSERT INTO public.cliente(id, limite, saldo)VALUES(5, 500000, 0);