Migrate from postgres to sqlite

This commit is contained in:
2024-09-03 19:51:37 +02:00
parent 67aa65386e
commit 8b97e64b59
13 changed files with 474 additions and 461 deletions

View File

@@ -1,5 +1,4 @@
import postgres from 'postgres'
import { drizzle } from 'drizzle-orm/postgres-js'
import { drizzle } from 'drizzle-orm/d1'
import * as schema from '../database/schema'
export { sql, eq, and, or, asc, desc, sum, isNull } from 'drizzle-orm'
@@ -7,8 +6,7 @@ export { sql, eq, and, or, asc, desc, sum, isNull } from 'drizzle-orm'
export const tables = schema
export function useDrizzle() {
const config = useRuntimeConfig()
return drizzle(postgres(config.postgres.url, { prepare: false, max: 50 }), { schema })
return drizzle(hubDatabase(), { schema })
}
export type UserInsert = typeof schema.users.$inferInsert