Cayter
Cayter
Explore posts from servers
DTDrizzle Team
Created by baronnoraz on 12/29/2023 in #help
Unit Testing with Transactions
if u r using postgres, check out db template In global setup, have a db template setup with ur latest schema with empty data ONCE in beforeEach, u run a script that: - clones this db template to a testdb<random_id> which will be used by every single unit test in isolation - mock ur db instance to use the testdb<random_id> The above will ensure that ur unit tests are all using different db (fully isolated) which u can even turn on test.concurrent to further speed up Using postgres db template to clone a fresh new db is way faster than dropping/recreating/migrating db over and over again, it's about 300ms Vs 1500ms on my Mac m1 i tried testcontainer, but as we have more tests running, we ended up start limiting the concurrent tests being run, this limit is way lower than the limit using postgres db template, well, it's a matter of N containers vs N databases in 1 container with each PG container using up 165MB
12 replies
DTDrizzle Team
Created by IstoraMandiri on 9/3/2023 in #help
Schema Definition Performance / Best Practice
This is a nextjs app router problem that's been going on for quite some time
2 replies
DTDrizzle Team
Created by Mohammed Anas on 8/10/2023 in #help
Aws Rds with drizzle
Data API has a lot of rough edges with most of the open source projects, I would avoid that if you need to deliver things fast
22 replies
DTDrizzle Team
Created by Mohammed Anas on 8/10/2023 in #help
Aws Rds with drizzle
https://docs.aws.amazon.com/cli/latest/reference/ecs/run-task.html This is assuming that your app runs in container though and yes we are using aws RDS postgres serverless v2
22 replies
DTDrizzle Team
Created by Mohammed Anas on 8/10/2023 in #help
Aws Rds with drizzle
U can spin up a fargate instance that's connected to Ur VPC to run the migrate command before deploying your app
22 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
Thx, just tried upgrading it, the Intellisense speed is almost instant but can't deploy yet due to CI type check failing https://github.com/drizzle-team/drizzle-orm/issues/988
195 replies
DTDrizzle Team
Created by Themion on 7/25/2023 in #help
Is there any tip for unit testing with drizzle?
u can use vitest --no-threads and make sure you have a global beforeEach() that runs truncate tables --no-threads ensures u only have 1 unit test running at a time, while it slows down the tests, but it ensures you have a real and clean-slate db to test against in the case it's really slow as your test suites grow, just split up the tests into N machines on your CI
17 replies
DTDrizzle Team
Created by hachoter on 6/26/2023 in #help
Is typescript slow for anyone else?
6 replies
DTDrizzle Team
Created by hachoter on 6/26/2023 in #help
Is typescript slow for anyone else?
6 replies
DTDrizzle Team
Created by Md Jahidul Islam milon on 6/18/2023 in #help
Drizzle in vscode Ts Server is very slow
there's an issue in the roadmap's backlog https://github.com/orgs/drizzle-team/projects/1 search for Decrease the amount of generated TS types (performance issues) it's been a while and still in backlog, at this point of time, it seems the team's focus is more on going broad to get more users instead of ensuring the existing features work well as our projects scale
17 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
i've been using 5.1 by configuring vscode to use node module's one, so i couldn't feel the difference between 5.0 and 5.1...
195 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
oh crap, it really helps a lot
195 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
i'm also using m1 pro
195 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
so basically just add as string to all the columns? does that break anything?
195 replies
DTDrizzle Team
Created by Luxaritas on 4/11/2023 in #help
Typescript build fails with large number of columns
did this actually work faster for u?
195 replies
DTDrizzle Team
Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
well, by right the inference should work automatically without the above, i'm not sure if it's because of we split up the schema into different files
12 replies
DTDrizzle Team
Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
the key point here is to ensure you declare your drizzle instance with typeof schema as the generic type
12 replies
DTDrizzle Team
Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
let's say i'm using postgres driver
import * as schema from "./schema"; // your schema might be different path

const queryClient = postgres("postgres://postgres:[email protected]:5432/db");
const db: PostgresJsDatabase<typeof schema> = drizzle(queryClient);
import * as schema from "./schema"; // your schema might be different path

const queryClient = postgres("postgres://postgres:[email protected]:5432/db");
const db: PostgresJsDatabase<typeof schema> = drizzle(queryClient);
once you have defined your schema and the relations in the schema, the type inference will work
12 replies
DTDrizzle Team
Created by Dbeg on 5/28/2023 in #help
Infer type for relational query
u guys did it wrongly
12 replies
DTDrizzle Team
Created by Cayter on 5/25/2023 in #help
Migrating from Prisma gradually
Thx man!!!
15 replies