mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-28 18:30:25 +01:00
Working on arthome
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import { drizzle } from 'drizzle-orm/d1'
|
||||
import postgres from 'postgres'
|
||||
import { drizzle } from 'drizzle-orm/postgres-js'
|
||||
import * as schema from '../database/schema'
|
||||
|
||||
export { sql, eq, and, or, asc, desc, sum } from 'drizzle-orm'
|
||||
export { sql, eq, and, or, asc, desc, sum, isNull } from 'drizzle-orm'
|
||||
|
||||
export const tables = schema
|
||||
|
||||
export function useDB() {
|
||||
return drizzle(hubDatabase(), { schema })
|
||||
export function useDrizzle() {
|
||||
const config = useRuntimeConfig()
|
||||
return drizzle(postgres(config.postgres.url, { prepare: false }), { schema })
|
||||
}
|
||||
|
||||
export type UserType = typeof schema.users.$inferSelect
|
||||
export type UserInsert = typeof schema.users.$inferInsert
|
||||
|
||||
export type TabType = typeof schema.tabs.$inferSelect
|
||||
export type CategoryType = typeof schema.categories.$inferSelect
|
||||
|
||||
Reference in New Issue
Block a user