Skip to content

Commit b1f3a45

Browse files
getevoclaude
andcommitted
Suppress warning when settings tables are missing on startup
LoadDatabaseSettings now checks whether the settings and settings_domain tables exist before querying them. If either is absent it returns nil silently, since the tables are created during migration and may not exist yet on first run. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 607ab99 commit b1f3a45

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/settings/database.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ func (Setting) TableName() string {
4747

4848
// LoadDatabaseSettings loads settings from the database.
4949
// Settings are organized by domains and loaded with their full hierarchical path.
50+
// If the settings or settings_domain tables do not exist yet, the function returns
51+
// silently without an error — the tables are optional and created during migration.
5052
func LoadDatabaseSettings() error {
53+
migrator := db.GetInstance().Migrator()
54+
if !migrator.HasTable(&Setting{}) || !migrator.HasTable(&SettingDomain{}) {
55+
return nil
56+
}
57+
5158
var settings []Setting
5259
var domains []SettingDomain
5360

0 commit comments

Comments
 (0)