summaryrefslogtreecommitdiff
path: root/script.sql
diff options
context:
space:
mode:
authorMateus Cruz <mateuscolvr@gmail.com>2024-02-05 18:48:47 -0300
committerMateus Cruz <mateuscolvr@gmail.com>2024-02-05 18:48:47 -0300
commitb2aed14fd4a252d77b7ebaf42407472c47d1c98b (patch)
treed705b9f371d6d5cdf5018b6036da5749dc35f4f9 /script.sql
parent8878b1d92bdd8ee9b51ecde7e9cc88f62f264841 (diff)
add logs and fix sql
Diffstat (limited to 'script.sql')
-rw-r--r--script.sql13
1 files changed, 9 insertions, 4 deletions
diff --git a/script.sql b/script.sql
index 7f3f3c0..9a2b3c2 100644
--- a/script.sql
+++ b/script.sql
@@ -15,20 +15,25 @@ CREATE TABLE transactions (
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
+CREATE INDEX idx_client_id_transactions ON transactions (client_id);
+
CREATE TABLE balances (
id SERIAL PRIMARY KEY,
client_id INTEGER REFERENCES clients,
value INTEGER NOT NULL
);
+CREATE INDEX idx_client_id_balances ON balances (client_id);
+
DO $$
BEGIN
INSERT INTO clients (name, mov_limit)
VALUES
- ('naruto', 1000 * 100),
- ('mob', 800 * 100),
- ('jojo', 10000 * 100),
- ('hellboy', 5000 * 100);
+ ('naruto', 100000),
+ ('mob', 80000),
+ ('jojo', 1000000),
+ ('hellboy', 10000000),
+ ('ultramega', 500000);
INSERT INTO balances (client_id, value)
SELECT id, 0 FROM clients;
END;