forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.sql
28 lines (25 loc) · 779 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
DROP TABLE IF EXISTS "balance";
CREATE TABLE "public"."balance" (
"id" integer NOT NULL,
"_limit" integer,
"total" integer NOT NULL,
CONSTRAINT "balance_pkey" PRIMARY KEY ("id")
) WITH (oids = false);
INSERT INTO "balance" ("id", "_limit", "total") VALUES
(1, 100000, 0),
(2, 80000, 0),
(3, 1000000, 0),
(4, 10000000, 0),
(5, 500000, 0);
DROP TABLE IF EXISTS "transaction";
CREATE TABLE "public"."transaction" (
"id" integer NOT NULL,
"created_at" timestamp(6),
"description" character varying(255),
"type" smallint,
"user_id" integer NOT NULL,
"value" integer NOT NULL,
CONSTRAINT "transaction_pkey" PRIMARY KEY ("id")
) WITH (oids = false);
CREATE SEQUENCE transaction_seq START 1;
CREATE INDEX user_idx ON transaction (user_id);