mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 06:11:45 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user