package db import ( "context" "database/sql" "fmt" ) func applyPragmas(ctx context.Context, db *sql.DB) error { pragmas := []string{ "PRAGMA foreign_keys = ON;", "PRAGMA journal_mode = WAL;", "PRAGMA busy_timeout = 5000;", } for _, pragma := range pragmas { if _, err := db.ExecContext(ctx, pragma); err != nil { return fmt.Errorf("apply pragma %q: %w", pragma, err) } } return nil }