Domski
Domski
DTDrizzle Team
Created by walkersyed581 on 9/21/2023 in #help
Trouble running JEST testing in Hono for Cloudfare Workers
I'll give that a go, thanks for the help!
8 replies
DTDrizzle Team
Created by walkersyed581 on 9/21/2023 in #help
Trouble running JEST testing in Hono for Cloudfare Workers
@walkersyed581 Hey sorry for waking this thread but I am struggling to get hono+cf workers set up with drizzle+d1, do you have a repo you can share? I think the db object needs to be set to the hono context during a middleware initialization but drizzle is using .env in its drizzle.config.ts so I'm not sure how to combine the two things.
export const dbMiddleware = createMiddleware<Environment>(async (c, next) => {
console.log('Creating database middleware...')
const client = createClient({
url: c.env.TURSO_CONNECTION_URL!,
authToken: c.env.TURSO_AUTH_TOKEN!
})

const db = drizzle(client)
c.set('db', db)
await next()
})

// --

export default defineConfig({
schema: './src/db/schema/*schema.ts',
out: './drizzle',
dialect: 'sqlite',
driver: 'turso',
dbCredentials: {
url: '??',
authToken: '??'
}
}) satisfies Config
export const dbMiddleware = createMiddleware<Environment>(async (c, next) => {
console.log('Creating database middleware...')
const client = createClient({
url: c.env.TURSO_CONNECTION_URL!,
authToken: c.env.TURSO_AUTH_TOKEN!
})

const db = drizzle(client)
c.set('db', db)
await next()
})

// --

export default defineConfig({
schema: './src/db/schema/*schema.ts',
out: './drizzle',
dialect: 'sqlite',
driver: 'turso',
dbCredentials: {
url: '??',
authToken: '??'
}
}) satisfies Config
8 replies
DTDrizzle Team
Created by louis on 10/2/2023 in #help
No such table: main.__old_push_[TABLENAME]
@Mykhailo I'm sorry to say I can't clear that part up but am constantly running into this same issue using Turso, Drizzle, Lucia auth as well. My workflow is as follows: - write my schema files - generate a migration file - push it to turso. The first time everything works just fine but when running a new migration I get that same error and the __old_push_ table is not deleted. My schemas are quite foreign-key heavy which I suppose is causing this problem.
77 replies
DTDrizzle Team
Created by Domski on 1/30/2024 in #help
Best practices for handling planetscale DatabaseErrors with Drizzle?
Unfortunately not, no
4 replies