storage/sqlite/sqlite-storage.go | 15 +++++++++------ diff --git a/storage/sqlite/sqlite-storage.go b/storage/sqlite/sqlite-storage.go index 44af1fdf6537b5f981ddd086c8210b49a9bffbad..8c2a770e1f8323ee5c8b4dfd1787af466da28217 100644 --- a/storage/sqlite/sqlite-storage.go +++ b/storage/sqlite/sqlite-storage.go @@ -154,6 +154,7 @@ Memory bool 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 @@ }() 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, @@ -223,12 +232,6 @@ // Needs the ConnPool size so it can initialize all the connections with pragmas. Takes ownership of // the ConnPool (since it has to initialize all the connections anyway). func NewProvider(pool ConnPool, opts ProviderOpts) (_ *provider, err error) { _, err = initPoolConns(context.TODO(), pool, opts.NumConns, true) - if err != nil { - return - } - conn := pool.Get(context.TODO()) - defer pool.Put(conn) - err = initSchema(conn) if err != nil { return }