Changeset 0.10.0 (#56)

This commit is contained in:
2026-02-24 14:50:53 +00:00
parent cdfd69bad3
commit ea03f956ca
31 changed files with 3303 additions and 167 deletions

View File

@@ -158,6 +158,8 @@ func TruncateAll(t *testing.T) {
}
// Order matters due to foreign keys — truncate with CASCADE
tables := []string{
"usage_log",
"model_pricing",
"notes",
"audit_log",
"channel_cursors",
@@ -178,6 +180,22 @@ func TruncateAll(t *testing.T) {
for _, table := range tables {
DB.Exec(fmt.Sprintf("TRUNCATE TABLE %s CASCADE", table))
}
// Re-seed global_settings — CASCADE from users wipes rows with updated_by FK.
// Re-run the seed SQL from migrations 001 + 004.
DB.Exec(`
INSERT INTO global_settings (key, value) VALUES
('registration', '{"enabled": true}'::jsonb),
('site', '{"name": "Chat Switchboard", "tagline": "Multi-Model AI Chat"}'::jsonb),
('banner', '{"enabled": false, "text": "", "position": "both", "bg": "#007a33", "fg": "#ffffff"}'::jsonb),
('banner_presets', '{}'::jsonb),
('model_roles', '{
"utility": { "primary": null, "fallback": null },
"embedding": { "primary": null, "fallback": null },
"generation": { "primary": null, "fallback": null }
}'::jsonb)
ON CONFLICT (key) DO NOTHING
`)
}
// SeedTestUser creates a test user and returns the user ID.