feat(budget): auto-generate recurring entry instances per month
Adds schema migration v3 (recurrence_parent_id column + budget_recurrence_skipped table). On every GET /api/v1/budget, the server checks all recurring originals (is_recurring=1, no parent) and creates missing instances for the requested month using the same day-of-month (clamped to the last day). Deleted instances are recorded in budget_recurrence_skipped so they are not recreated on the next visit. Generated instances are shown with a ↩ indicator in the transaction list. Closes BL-05. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -278,6 +278,22 @@ const MIGRATIONS = [
|
||||
CREATE INDEX IF NOT EXISTS idx_calendar_external_id ON calendar_events(external_calendar_id);
|
||||
`,
|
||||
},
|
||||
{
|
||||
version: 3,
|
||||
description: 'Wiederkehrende Budget-Einträge: parent-Referenz und Skip-Tabelle',
|
||||
up: `
|
||||
ALTER TABLE budget_entries ADD COLUMN recurrence_parent_id INTEGER
|
||||
REFERENCES budget_entries(id) ON DELETE SET NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS budget_recurrence_skipped (
|
||||
parent_id INTEGER NOT NULL REFERENCES budget_entries(id) ON DELETE CASCADE,
|
||||
month TEXT NOT NULL,
|
||||
PRIMARY KEY (parent_id, month)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_budget_parent ON budget_entries(recurrence_parent_id);
|
||||
`,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user