15 lines
429 B
TypeScript
15 lines
429 B
TypeScript
import { drizzle } from "drizzle-orm/better-sqlite3";
|
|
import * as schema from "../database/schema";
|
|
|
|
export const tables = schema;
|
|
|
|
export function useDrizzle() {
|
|
const config = useRuntimeConfig();
|
|
|
|
return drizzle(config.databaseUrl, { schema });
|
|
}
|
|
|
|
export type User = typeof schema.users.$inferSelect;
|
|
export type Preferences = typeof schema.preferences.$inferSelect;
|
|
export type Tokens = typeof schema.tokens.$inferSelect;
|