-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathinit.sql
36 lines (27 loc) · 756 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
28
29
30
31
32
33
34
35
36
CREATE UNLOGGED TABLE IF NOT EXISTS "client" (
"id" integer NOT NULL,
"limit" integer NOT NULL,
"balance" integer NOT NULL
);
CREATE UNLOGGED TABLE IF NOT EXISTS "transactions" (
"id" serial NOT NULL,
"amount" integer NOT NULL,
"type" smallint NOT NULL,
"description" text NOT NULL,
"created_at" timestamp DEFAULT now(),
"client_id" integer NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_client_id ON "transactions" (client_id);
CREATE EXTENSION IF NOT EXISTS pg_prewarm;
SELECT pg_prewarm('client');
SELECT pg_prewarm('transactions');
INSERT INTO public.client (id,"limit",balance) VALUES
(1,100000,0),
(2,80000,0),
(3,1000000,0),
(4,10000000,0),
(5,500000,0);
/*
FROM library/postgres
COPY init.sql /docker-entrypoint-initdb.d/
*/