fix(db): apply additive schema changes on every boot

Migration was gated on a version-bump marker, so new columns added
between releases (task.hidden, user.ban_expires, storage_policies.status)
never reached existing databases and the server failed at first use.

Schema.Create is diff-based and never drops columns by default, so
running it unconditionally is a no-op when the schema matches.

Authored By: TDvorak <info@tdvorak.dev>

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
pull/3582/head
Tomas Dvorak 2 weeks ago
parent e1c2864ae7
commit ba9a2b3d57

@ -37,6 +37,11 @@ func InitializeDBClient(l logging.Logger,
return nil, fmt.Errorf("failed to migrate database: %w", err) return nil, fmt.Errorf("failed to migrate database: %w", err)
} }
} else { } else {
// Version is current, but additive schema changes (new columns)
// still need to reach existing databases between releases.
if err := client.Schema.Create(ctx); err != nil {
return nil, fmt.Errorf("failed to apply additive schema changes: %w", err)
}
l.Info("Database schema is up to date.") l.Info("Database schema is up to date.")
} }

Loading…
Cancel
Save