feat(budget): bidirectional sync between reservations and budget items

- Link budget items to reservations via reservation_id column
- Update budget entry when reservation price changes (not create duplicate)
- Delete budget entry when reservation price is cleared
- Sync price back to reservation when edited in budget panel
- Lock budget item name when linked to a reservation
- Add migration 73 for reservation_id on budget_items
This commit is contained in:
Maurice
2026-04-05 18:16:02 +02:00
parent cd5a6c7491
commit 38206883ff
8 changed files with 65 additions and 17 deletions
+4
View File
@@ -822,6 +822,10 @@ function runMigrations(db: Database.Database): void {
() => {
db.exec('DROP TABLE IF EXISTS notification_preferences;');
},
// Migration 73: Add reservation_id to budget_items for linking budget entries to reservations
() => {
try { db.exec('ALTER TABLE budget_items ADD COLUMN reservation_id INTEGER REFERENCES reservations(id) ON DELETE SET NULL DEFAULT NULL'); } catch (err: any) { if (!err.message?.includes('duplicate column name')) throw err; }
},
];
if (currentVersion < migrations.length) {