fix: add stock_calculation_mode ALTER migration for backward compatibility (#39)

Older production databases were missing the stock_calculation_mode column,
causing 500 errors on /export endpoint. Added migration to add column
with default value 'automatic'.
This commit is contained in:
Daniel Volz
2026-01-18 08:23:35 +01:00
committed by GitHub
parent 8928915947
commit 42d00dd1c0
+2
View File
@@ -73,6 +73,8 @@ export async function runAlterMigrations(client: Client): Promise<{ success: boo
`ALTER TABLE user_settings ADD COLUMN max_nagging_reminders integer NOT NULL DEFAULT 5`,
// Added in v1.2.3 - dismiss missed doses without deducting stock
`ALTER TABLE dose_tracking ADD COLUMN dismissed integer NOT NULL DEFAULT 0`,
// Added in v1.3.x - stock calculation mode (automatic/manual)
`ALTER TABLE user_settings ADD COLUMN stock_calculation_mode text NOT NULL DEFAULT 'automatic'`,
];
for (const sql of alterMigrations) {