lifetracker/packages/db/index.ts

18 lines
560 B
TypeScript

import Database from "better-sqlite3";
import { ExtractTablesWithRelations } from "drizzle-orm";
import { SQLiteTransaction } from "drizzle-orm/sqlite-core";
import * as schema from "./schema/day";
export { db } from "./drizzle";
export * as schema from "./schema/day";
export { SqliteError } from "better-sqlite3";
// This is exported here to avoid leaking better-sqlite types outside of this package.
export type LifetrackerDBTransaction = SQLiteTransaction<
"sync",
Database.RunResult,
typeof schema,
ExtractTablesWithRelations<typeof schema>
>;