How to fix collision / race condition

Hey there. I am working on a project with another team member. We are using Drizzle ORM. I merged the code of my team mate to my branch and when I trying to generate a new migration, I am getting this error: [src\database\migrations\meta\20241122205314_snapshot.json, src\database\migrations\meta\20241125185203_snapshot.json] are pointing to a parent snapshot: src\database\migrations\meta\20241122205314_snapshot.json/snapshot.json which is a collision. I searched the internet but not able to find any solution for it. Can anyone from Drizzle team help me resolve this issue. I am using "drizzle-orm": "^0.36.1"
5 Replies
Angelelz
Angelelz4w ago
If you have everything in source control you could just drop one migration, and then generate it again so that it follows a linear history
atri
atriOP4w ago
@Angelelz Is Drizzle team working that race condition doesn't happen?
Angelelz
Angelelz4w ago
I don't think this is even in their radar. Because the issue is that two developers created different migrations in different branches. This would be an issue even if drizzle wasn't involved
atri
atriOP4w ago
got you. @Angelelz Does Drizzle allows you to write queries like we have in other ORMs (Prisma, TypeORM, Sequelize etc): await db.users.findUnique({ where: { id, }, select: { id: true, first_name: true, last_name: true, }, }); I am asking specifically for NestJS. What I have seen is that it only allows you to write queries in traditional SQL fashion.
Angelelz
Angelelz4w ago
Relational queries is one level of abstraction similar to what you’re looking for. You can read about it in the docs https://orm.drizzle.team/docs/rqb
Drizzle ORM - Query
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Want results from more Discord servers?
Add your server