InitTestFileDBRaw initializes a file-based test database at the specified path with the default schema.
(t *testing.T, dbPath string)
| 68 | |
| 69 | // InitTestFileDBRaw initializes a file-based test database at the specified path with the default schema. |
| 70 | func InitTestFileDBRaw(t *testing.T, dbPath string) *DB { |
| 71 | db, err := Open(dbPath) |
| 72 | if err != nil { |
| 73 | t.Fatal(errors.Wrap(err, "opening database")) |
| 74 | } |
| 75 | |
| 76 | if _, err := db.Exec(defaultSchemaSQL); err != nil { |
| 77 | t.Fatal(errors.Wrap(err, "running schema sql")) |
| 78 | } |
| 79 | |
| 80 | t.Cleanup(func() { db.Close() }) |
| 81 | return db |
| 82 | } |
| 83 | |
| 84 | // InitTestMemoryDBRaw initializes an in-memory test database without marking migrations complete. |
| 85 | // If schemaPath is empty, uses the default schema. Used for migration testing. |
no test coverage detected