Persistent storage (EF Core)
By default all state is in memory and resets on restart. Add
UKBatch.Storage.EntityFrameworkCore to persist batch definitions, execution history, and
approval records to PostgreSQL or SQLite.
services.AddUKBatch(b => b.AddJob<HelloJob>()) .AddUKBatchEntityFrameworkCoreStores(o => o.UseSqlite("Data Source=ukbatch.db"));// or: o.UsePostgres("Host=localhost;Database=ukbatch;Username=ukbatch;Password=…")Register the EF stores after AddUKBatch / AddUKBatchApi — they replace the in-memory
registrations. The package ships design-time migrations for both providers; set
o.MigrateOnStartup = true for dev, or run dotnet ef database update in production.
samples/Sample.RestApi takes a --storage inmemory|ef-sqlite|ef-pg flag so you can watch
the same app run on each store. The repo’s smoke-restart-sqlite.sh triggers a batch,
pauses it at an approval gate, kill -9s the process, restarts over the same .db file,
and shows the pending approval + execution history still there.