fix(seed): skip seeding if database already contains markets

This commit is contained in:
2026-02-22 11:39:26 +01:00
parent ffaee89243
commit 993bab1218

View File

@@ -65,6 +65,15 @@ func run() error {
return fmt.Errorf("parse markets JSON: %w", err)
}
var count int
if err := pool.QueryRow(ctx, "SELECT count(*) FROM markets").Scan(&count); err != nil {
return fmt.Errorf("check market count: %w", err)
}
if count > 0 {
slog.Info("database already seeded, skipping", "existing", count)
return nil
}
slog.Info("seeding markets", "count", len(markets))
geoCache := make(map[string][2]float64)