mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-23 14:36:29 +01:00
improve db client + add separate dev db
This commit is contained in:
parent
3f9547f014
commit
cd5ae0f69f
5 changed files with 28 additions and 2 deletions
|
|
@ -1,8 +1,18 @@
|
|||
import { drizzle } from 'drizzle-orm/d1';
|
||||
import type { Context } from 'hono';
|
||||
|
||||
export function dbConn(c: Context){
|
||||
export interface Env {
|
||||
d1_db: D1Database;
|
||||
}
|
||||
|
||||
export function getDbContext(c: Context){
|
||||
return drizzle(c.env.d1_db, {
|
||||
casing: 'snake_case'
|
||||
})
|
||||
}
|
||||
|
||||
export function getDbEnv(env: Env){
|
||||
return drizzle(env.d1_db, {
|
||||
casing: 'snake_case'
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue