Arthur Danjou 🧸
Arthur Danjou 🧸
Explore posts from servers
DTDrizzle Team
Created by Arthur Danjou 🧸 on 4/17/2024 in #help
Migration from prisma to Drizzle
Better than prisma
6 replies
DTDrizzle Team
Created by Arthur Danjou 🧸 on 4/17/2024 in #help
Migration from prisma to Drizzle
SImplified with drizzle
6 replies
DTDrizzle Team
Created by Arthur Danjou 🧸 on 4/17/2024 in #help
Migration from prisma to Drizzle
I found the solution :
const talents = await useDB().query.talents
.findMany({
orderBy: [asc(tables.talents.id)],
with: {
talentCategories: {
with: {
category: true,
},
},
},
})

return talents.filter(talent =>
(category === 'all' || talent.talentCategories.some(cat => cat.category.slug === category))
&& (favorite === 'false' || talent.favorite),
)
const talents = await useDB().query.talents
.findMany({
orderBy: [asc(tables.talents.id)],
with: {
talentCategories: {
with: {
category: true,
},
},
},
})

return talents.filter(talent =>
(category === 'all' || talent.talentCategories.some(cat => cat.category.slug === category))
&& (favorite === 'false' || talent.favorite),
)
`
6 replies
DTDrizzle Team
Created by Arthur Danjou 🧸 on 4/17/2024 in #help
Migration from prisma to Drizzle
I have to parameters : favorite and category. Favorite is a Boolean and category is a string (saved in db in the categories table). I want to fetch all the bookmarks of the selected category where the bookmarks are favorite or not (if favorite param is checked). And the category param can be ‘all’ so I want to fetch all the bookmarks favorite or not (depends again of the favorite param)
6 replies