Worker: enable SQLite foreign keys

They're not used now, but enabling them is good default behaviour anyway.
This commit is contained in:
Sybren A. Stüvel 2022-06-20 12:07:38 +02:00
parent de5d12362d
commit 2a4c9b2c13

View File

@ -77,6 +77,10 @@ func (ub *UpstreamBufferDB) OpenDB(dbCtx context.Context, databaseFilename strin
return fmt.Errorf("accessing %s: %w", databaseFilename, err)
}
if _, err := db.ExecContext(dbCtx, "PRAGMA foreign_keys = 1"); err != nil {
return fmt.Errorf("enabling foreign keys: %w", err)
}
ub.db = db
if err := ub.prepareDatabase(dbCtx); err != nil {