diff options
Diffstat (limited to 'script.sql')
-rw-r--r-- | script.sql | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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; |