Auto-seed lookups + admin + templates on first API boot
Some checks failed
Some checks failed
Add a data_migration that runs seeds/001_lookups.sql, seeds/003_admin_user.sql, and seeds/003_task_templates.sql exactly once on startup and invalidates the Redis seeded_data cache afterwards so /api/static_data/ returns fresh results. Removes the need to remember `./dev.sh seed-all`; the data_migrations tracking row prevents re-runs, and each INSERT uses ON CONFLICT DO UPDATE so re-execution is safe.
This commit is contained in:
@@ -81,6 +81,13 @@ func main() {
|
||||
cache = nil
|
||||
} else {
|
||||
defer cache.Close()
|
||||
if database.SeedInitialDataApplied {
|
||||
if err := cache.InvalidateSeededData(context.Background()); err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to invalidate seeded data cache after initial seed")
|
||||
} else {
|
||||
log.Info().Msg("Invalidated seeded_data cache after initial seed migration")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize monitoring service (if Redis is available)
|
||||
|
||||
Reference in New Issue
Block a user