fix(db): add vet_name, result, next_due to healthMigrations ALTER TABLE guards #38

Merged
jason merged 1 commits from fix/health-records-missing-columns into master 2026-03-10 12:52:41 -05:00
Showing only changes of commit 9b43bdab99 - Show all commits

View File

@@ -128,7 +128,7 @@ function initDatabase() {
)
`);
// migrate: add OFA-specific columns if missing
// migrate: add OFA-specific columns if missing (covers existing DBs)
const healthMigrations = [
['test_type', 'TEXT'],
['ofa_result', 'TEXT'],
@@ -136,6 +136,9 @@ function initDatabase() {
['performed_by', 'TEXT'],
['expires_at', 'TEXT'],
['document_url', 'TEXT'],
['result', 'TEXT'],
['vet_name', 'TEXT'],
['next_due', 'TEXT'],
];
for (const [col, def] of healthMigrations) {
try { db.exec(`ALTER TABLE health_records ADD COLUMN ${col} ${def}`); } catch (_) { /* already exists */ }