-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathscript.sql
36 lines (32 loc) · 928 Bytes
/
script.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
CREATE UNLOGGED TABLE IF NOT EXISTS clients (
id SERIAL PRIMARY KEY,
limite INTEGER NOT NULL,
saldo INTEGER NOT NULL
);
CREATE UNLOGGED TABLE IF NOT EXISTS transactions (
id SERIAL PRIMARY KEY,
tipo CHAR(1) NOT NULL,
descricao VARCHAR(10) NOT NULL,
cliente_id INTEGER NOT NULL,
valor INTEGER NOT NULL,
realizada_em TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_cliente_id ON transactions(cliente_id);
INSERT INTO clients (limite, saldo)
VALUES
(100000, 0),
(80000, 0),
(1000000, 0),
(10000000, 0),
(50000, 0);
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
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;