Noahh
Noahh
DTDrizzle Team
Created by SDSS on 5/21/2024 in #help
Ability to call Drizzle-Kit push function via import
Right now there isn't a way to use pull directly from code as far as I am aware. However, if you've run drizzle-kit generate which creates the SQL migration files, you can then use the migrate function to apply the migrations to a database. I'm not sure it would apply for your use case (are you generating a new custom schema each time, or is it the same Drizzle schema just separated in the db?), but if you're always using the same Drizzle schema, that means you can just run drizzle-kit generate once and then migrate() should work perfectly when you need it. If your use case is more complex than I'm assuming, I'd be happy to chat more about it to see where Drizzle could help you. https://orm.drizzle.team/docs/migrations
4 replies
DTDrizzle Team
Created by gaurav1998 on 5/20/2024 in #help
Exploring Type Safety in Drizzle: Does Zod Enhance or Redundantly Overlap?
In my experience, yes, but it depends on your use case. Imagine you have a Drizzle schema and a CRUD API for that schema. you can type-check the body all you want, but if a different body is passed at runtime, your code will fail. That's where Zod comes in: checking the body at runtime and validating it's in the correct format. That's why drizzle-zod is so helpful, because you can really easily validate that an object will fit into your Drizzle schema. However, it becomes slightly less helpful when you have APIs that don't match the format of your Drizzle schema. I'd still recommend Zod to check the structures at runtime though :D
2 replies
DTDrizzle Team
Created by THE MASTER on 1/9/2024 in #help
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins
It was confusing, but it wasn't nearly as bad as I thought. I couldn't find any documentation for it, but it seems like instrumentation.js|ts runs in the node AND browser context, meaning that importing any node module failed in the browser context. My final solution was this:
if(process.env.NEXT_RUNTIME === 'nodejs') {
await import('stuff-that-uses-node-modules');
}
if(process.env.NEXT_RUNTIME === 'nodejs') {
await import('stuff-that-uses-node-modules');
}
3 replies
DTDrizzle Team
Created by THE MASTER on 1/9/2024 in #help
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins
This is pretty late (hope you've solved it by now!) but I've been working through this issue recently and just wanted to put my two cents in. It seems like the main problem with your specific instance is that you're trying to use a node module on the clientside (since you import it in a 'use client' component). For you, the first would be as easy as wrapping the client component in a server component that imports the db and passes any information down as props. The unfortunate thing is I'm trying to do this with Next.js' experimental instrumentation and I'm hitting the same issues, which is weird because it should only run on the server... I'll drop back in once I find more
3 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
(never worked with planetscale or mysql with drizzle so i'm just assuming, it doesn't seem like there is a planetscale driver specifically)
11 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
yep, so since Planetscale is mysql, I believe you need to use the mysql2 driver
11 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
The config file helps Drizzle Kit commands run. So, when you pnpm drizzle-kit generate:pg, it needs to know 1. where you schema files are so it can run them 2. where you want your SQL files to output with push, it needs to know the same information, but it also needs to know what driver you're using (pg, mysql2, etc.), as well as your connection string so it can properly connect to the database and apply the migrations
11 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
11 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
11 replies
DTDrizzle Team
Created by Fil on 9/14/2023 in #help
Having Issues Pushing Database Schema
Can you share your drizzle.config file?
11 replies
DTDrizzle Team
Created by Jeremy on 9/14/2023 in #help
migration failed
👍
5 replies
DTDrizzle Team
Created by Jeremy on 9/14/2023 in #help
migration failed
if your folder isn't named that that could be why
5 replies
DTDrizzle Team
Created by Jeremy on 9/14/2023 in #help
migration failed
Is drizzel supposed to be spelled that way?
5 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
sweet
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
apparently reverting back, generating, then generating again helped someone? https://discord.com/channels/1043890932593987624/1070810929475883038/1145412231392149545
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
interesting
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
maybe a primary key was removed from your schema recently?
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
gotcha, it looks like this is a known issue: https://github.com/drizzle-team/drizzle-kit-mirror/issues/170
44 replies
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
are you able to post the full stack trace and anywhere in your schema you're creating composite primary keys?
44 replies
DTDrizzle Team
Created by LouieMartin on 9/9/2023 in #help
error: Cannot find module "@libsql/linux-x64-musl" from "~/todion/node_modules/libsql/index.js"
By the way, I'm not sure it fits your use-case but Bun:sqlite would be guaranteed to work on Bun :P
46 replies