Startup Spells 🪄 Newsletter Guy
DTDrizzle Team
•Created by Fyzz on 3/30/2024 in #help
Turso DB reads (alot)
https://github.com/deadcoder0904/easypanel-nextjs-sqlite (see im using some best practices here but the schema is small enough but u can ask me as i have decent mid-sized project with a bit complex structure)
6 replies
DTDrizzle Team
•Created by Fyzz on 3/30/2024 in #help
Turso DB reads (alot)
bdw, check if you are setting index or not. indexes are very important to get results fast.
6 replies
DTDrizzle Team
•Created by Fyzz on 3/30/2024 in #help
Turso DB reads (alot)
it shouldnt happen like this. try logging your queries to see which one run a lot. turso should show it in ui. at least planetscale used to. but still this shouldnt happen. definitely do join. drizzle sends 1 query only & performs joins well. i even joined 3 tables lol.
6 replies
DTDrizzle Team
•Created by 1girl, best quality on 3/31/2024 in #help
`drizzle-kit generate:sqlite` doesn't work
note that i did read few weeks/months back that drizzle + bun dont gel well. in any case, you can use node for now until bun gets really stable. give it 6 months or so to hash out bugs & all.
13 replies
DTDrizzle Team
•Created by 1girl, best quality on 3/31/2024 in #help
`drizzle-kit generate:sqlite` doesn't work
i use drizzle with sqlite. check out if u r doing the same -> https://github.com/deadcoder0904/easypanel-nextjs-sqlite
13 replies
DTDrizzle Team
•Created by Heisnberg on 3/23/2024 in #help
Issues with the generated sql files
see if the sql query works in drizzle studio's sql runner... you can even paste it in drizzle runner... both can be found on drizzle studio
10 replies
DTDrizzle Team
•Created by Heisnberg on 3/23/2024 in #help
Issues with the generated sql files
and what does it point to towards code? like it should point towards a line number in your editor. if it doesn't, then you need to use
console.log
or debugger to find where the error lies in the code. try commenting stuff out one-by-one where you think the code is unreachable.
if you know binary search, then you can do a half-way comment & see if it reaches that part of the code.
you need to put more effort mate to find it. the error is what it says it is. a syntax error somewhere in the code.
maybe see if the same code works if you use another database like sqlite. then you can come back & try to fix it.
or better yet, make a minimal reproduction on github/stackblitz with just the error. ik its a lot of work. will take 1-2 hours but you'll learn quickly that way & find the error faster.10 replies
DTDrizzle Team
•Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
i just use
node --env-file .env.production drizzle-migrate.mjs
script for now as bun windows hasn't come yet. just 7 days away so i can replace those scripts with bun too lol. or maybe wait 6 months for it to get stable.19 replies
DTDrizzle Team
•Created by Heisnberg on 3/23/2024 in #help
Issues with the generated sql files
not enough info on the error. paste the whole error & note the line down in console. it should point to the code that's erroring out. at least line number.
10 replies
DTDrizzle Team
•Created by CS on 3/24/2024 in #help
What am I doing wrong with migrations?
i run migrations manually like you said in npm scripts. example -> https://github.com/deadcoder0904/easypanel-nextjs-sqlite or any projects in my profile
i did face this error today randomly. idk why. i deleted my sqlite file & re-ran again & it worked.
i dont think that migrations re-run again if the table already exists so thats definitely a weird error as all migrations cli handle that part automatically. maybe a schema change?
19 replies
DTDrizzle Team
•Created by brazendynamo on 3/22/2024 in #help
Separate file for relations
maybe make a minimal reproduction on stackblitz so others can chime in & help.
just use 2 tables to prove a point.
idk technically it should work.
6 replies
DTDrizzle Team
•Created by brazendynamo on 3/22/2024 in #help
Separate file for relations
why would you wanna do that? keep them colocated in the same file itself so its easier to read.
it wont be a problem until you have >1000 lines of code (loc's) & 20-30 tables.
but yes it should be technically possible.
since relations are the only one that refer tables, you can import all tables in
relations.ts
& then try.
but this might be a circular dependency error which sometimes happens when one file is referencing other file & that other file is referencing that file.
even tho it shouldnt happen in this case.
but i think ur prematurely optimizing it right now.
just use 1 file for everything.6 replies
DTDrizzle Team
•Created by nr7751 on 2/26/2024 in #help
Can someone direct me to a UUID implementation as PK with Drizzle ORM?
i also tried using
sqlite
extension using ulid but it wasn't working for some reason. https://github.com/asg017/sqlite-ulid/issues/925 replies
DTDrizzle Team
•Created by nr7751 on 2/26/2024 in #help
Can someone direct me to a UUID implementation as PK with Drizzle ORM?
i use it like this:
25 replies
DTDrizzle Team
•Created by Startup Spells 🪄 Newsletter Guy on 3/22/2024 in #help
How to set timestamp for `created_at` in Drizzle on SQLite?
Alright, thought of using Sourcegraph with
drizzle-orm/sqlite-core AND createdAt
query -> https://sourcegraph.com/search?q=drizzle-orm%2Fsqlite-core+AND+createdAt&patternType=standard&sm=0
Found the solution:
2 replies
DTDrizzle Team
•Created by x03 on 3/19/2024 in #help
How do I apply migrations on cloudflare workers?
this probably means cloudflare doesnt have
node:fs
right? find the equivalent of node:fs
in cloudflare. i think since it is in node_modules
, then you'll have to use patch-project dependency & patch it yourself. dont know how other cloudflare people do it. maybe search on sourcegraph drizzle AND cloudflare lang:TypeScript
to see if anything shows up23 replies
DTDrizzle Team
•Created by hacktographer on 8/25/2023 in #help
How are you all seeding your database?
yeah i had posted that as a comment when i was trying to get it work as i got the error. the author included it in the post later i guess. in a few days, we can all use bun instead of tsx, dotenv, etc...
11 replies
DTDrizzle Team
•Created by hacktographer on 8/25/2023 in #help
How are you all seeding your database?
11 replies
DTDrizzle Team
•Created by babakfp on 2/11/2024 in #help
ERROR 500. SvelteKit + Drizzle + better-sqlite
it says sqlite is not supported with vercel. makes sense as vercel pushes serverless down your throat https://vercel.com/guides/is-sqlite-supported-in-vercel
5 replies
DTDrizzle Team
•Created by babakfp on 2/11/2024 in #help
ERROR 500. SvelteKit + Drizzle + better-sqlite
5 replies