Made scheduled transactions more generic.

This commit is contained in:
2026-09-24 21:07:38 +02:00
parent 18cf7e6bdd
commit 9e5a976ac7
17 changed files with 235 additions and 92 deletions
@@ -1,6 +1,7 @@
CREATE TABLE transactions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
description TEXT NOT NULL,
amount_cents BIGINT NOT NULL,
amount_cents BIGINT NOT NULL CHECK (amount_cents >= 0),
direction TEXT NOT NULL CHECK (direction IN ('in', 'out')),
date TIMESTAMPTZ NOT NULL DEFAULT now()
);
@@ -1,7 +1,8 @@
CREATE TABLE recurring_expenses (
CREATE TABLE recurring_transactions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
name TEXT NOT NULL,
amount_cents BIGINT NOT NULL,
amount_cents BIGINT NOT NULL CHECK (amount_cents >= 0),
direction TEXT NOT NULL CHECK (direction IN ('in', 'out')),
starts_at TIMESTAMPTZ NOT NULL,
ends_at TIMESTAMPTZ,
recurrence_every INTEGER NOT NULL CHECK (recurrence_every > 0),
@@ -0,0 +1,57 @@
INSERT INTO
transactions (
id,
description,
amount_cents,
direction,
date
)
VALUES (
'00000000-0000-0000-0000-000000000001',
'Salary',
320000,
'in',
'2026-09-01T09:00:00Z'
),
(
'00000000-0000-0000-0000-000000000002',
'Groceries',
8450,
'out',
'2026-09-18T17:30:00Z'
);
INSERT INTO
recurring_transactions (
id,
name,
amount_cents,
direction,
starts_at,
ends_at,
recurrence_every,
recurrence_unit,
weekend_adjustment
)
VALUES (
'00000000-0000-0000-0000-000000000101',
'Salary',
320000,
'in',
'2026-10-01T09:00:00Z',
NULL,
1,
'month',
NULL
),
(
'00000000-0000-0000-0000-000000000102',
'Rent',
125000,
'out',
'2026-10-01T09:00:00Z',
NULL,
1,
'month',
'previous_business_day'
);