diff --git a/storage/sqlite/sqlite-storage.go b/storage/sqlite/sqlite-storage.go index 44af1fdf..8c2a770e 100644 --- a/storage/sqlite/sqlite-storage.go +++ b/storage/sqlite/sqlite-storage.go @@ -154,6 +154,7 @@ type NewPoolOpts struct { NumConns int // Forces WAL, disables shared caching. ConcurrentBlobReads bool + DontInitSchema bool } // There's some overlap here with NewPoolOpts, and I haven't decided what needs to be done. For now, @@ -190,6 +191,14 @@ func NewPool(opts NewPoolOpts) (_ ConnPool, _ ProviderOpts, err error) { if err != nil { return } + if !opts.DontInitSchema { + conn := conns.Get(context.TODO()) + defer conns.Put(conn) + err = initSchema(conn) + if err != nil { + return + } + } return conns, ProviderOpts{ NumConns: opts.NumConns, ConcurrentBlobRead: opts.ConcurrentBlobReads, @@ -226,12 +235,6 @@ func NewProvider(pool ConnPool, opts ProviderOpts) (_ *provider, err error) { if err != nil { return } - conn := pool.Get(context.TODO()) - defer pool.Put(conn) - err = initSchema(conn) - if err != nil { - return - } writes := make(chan writeRequest) prov := &provider{pool: pool, writes: writes, opts: opts} runtime.SetFinalizer(prov, func(p *provider) {