forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sql
51 lines (43 loc) · 1.19 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
-- CreateTable
-- CreateTable
CREATE TABLE "clientes" (
"id" SERIAL NOT NULL,
"limite" INTEGER NOT NULL,
"saldo" INTEGER NOT NULL,
CONSTRAINT "clientes_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "transacoes" (
"id" SERIAL NOT NULL,
"cliente_id" INTEGER NOT NULL,
"valor" INTEGER NOT NULL,
"tipo" TEXT NOT NULL,
"descricao" TEXT NOT NULL,
"realizada_em" TIMESTAMP(3) NOT NULL,
CONSTRAINT "transacoes_pkey" PRIMARY KEY ("id"),
CONSTRAINT "transacoes_cliente_id_fkey" FOREIGN KEY ("cliente_id") REFERENCES "clientes" ("id")
);
INSERT INTO
"clientes" ("limite","saldo")
VALUES
(100000, 0),
(80000, 0),
(1000000, 0),
(10000000, 0),
(500000, 0);
-- CREATE TABLE "clientes" (
-- "id" SERIAL NOT NULL,
-- "limite" INTEGER NOT NULL,
-- "saldo" INTEGER NOT NULL,
-- CONSTRAINT "clientes_pkey" PRIMARY KEY ("id")
-- );
-- -- CreateTable
-- CREATE TABLE "transacoes" (
-- "id" SERIAL NOT NULL,
-- "cliente_id" INTEGER NOT NULL,
-- "valor" INTEGER NOT NULL,
-- "tipo" TEXT NOT NULL,
-- "descricao" TEXT NOT NULL,
-- "realizada_em" TIMESTAMP(3) NOT NULL,
-- CONSTRAINT "transacoes_pkey" PRIMARY KEY ("id")
-- );