From 2e50736e67f2c62e6bb81dbf4ffdc12d9de4eeda Mon Sep 17 00:00:00 2001 From: wispem-wantex Date: Sat, 31 Jan 2026 20:35:03 -0800 Subject: [PATCH] schema: enable parsing a schema from an existing sqlx.DB instance --- pkg/schema/parse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/schema/parse.go b/pkg/schema/parse.go index c2f5876..2c3c50d 100644 --- a/pkg/schema/parse.go +++ b/pkg/schema/parse.go @@ -21,7 +21,6 @@ var create_views string func InitDB(sql_schema string) *sqlx.DB { db := sqlx.MustOpen("sqlite3", ":memory:") db.MustExec(sql_schema) - db.MustExec(create_views) return db } @@ -36,6 +35,7 @@ func SchemaFromSQLFile(filepath string) (Schema, error) { // SchemaFromDB takes a DB connection, checks its schema metadata tables, and returns a Schema. func SchemaFromDB(db *sqlx.DB) Schema { ret := Schema{Tables: map[string]Table{}, Indexes: map[string]Index{}} + db.MustExec(create_views) var tables []Table PanicIf(db.Select(&tables, `select name, table_type, is_strict, is_without_rowid from tables`))