Use directory instead of schema in drizzle proxy definition
We using the proxy in electron js, when we add schema in files everything working well, but we split schema in many files.
import { drizzle } from 'drizzle-orm/sqlite-proxy';
import * as schema from './db/schema/sync'
declare global {
interface Window {
api: {
execute: (...args: any) => Promise<any>
}
}
}
export const database = drizzle(async (...args) => {
try {
const result = await window.api.execute(...args)
return {rows: result}
} catch (e: any) {
console.error('Error from sqlite proxy server: ', e.response.data)
return { rows: [] }
}
}, {
schema: schema, /// where how specific directory instead of file.
})
0 Replies