8 lines
371 B
SQL
8 lines
371 B
SQL
CREATE TABLE transactions (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
|
|
account_id UUID NOT NULL CONSTRAINT fk_transactions_account REFERENCES accounts (id),
|
|
amount_cents BIGINT NOT NULL CHECK (amount_cents >= 0),
|
|
direction TEXT NOT NULL CHECK (direction IN ('in', 'out')),
|
|
date TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
description TEXT NOT NULL
|
|
); |