thank you!! im migrating from prisma, i
thank you!! im migrating from prisma, i had this enum Status {
DRAFT
PUBLISHED
ARCHIVED
}
having a hard time defining here
properties: defineTable({
title: v.string(),
description: v.string(),
price: v.number(),
propertyType: v.string(),
}),
18 Replies
you're awesome thank you
last question i think lol, how about default values?
promoted Boolean @default(false)
is it promoted: v.boolean() || false,
@erquhart
Doesn't have to be last question 🙂
Default values you'll handle in your mutations.
what if i do v.optional(v.bool
If you want the value to always be populated, don't make it optional
oh undefined i see
i like how opinionated convex is so far
they're pretty great opinions
(I don't work for Convex so I can say that lol)
haha, and many to many, one to many? is just v.id("table") correct?
i like how drizzle relations does it
yep, id field is how you handle relations. How does drizzle do it?
let me show u gotta open another old repo
Yeah there will be libraries to provide these kinds of ergonomics, the canonical one so far is Ents: https://labs.convex.dev/convex-ents
It's an early effort that probably won't go much further, so not necessarily one to use, but it shows what's possible.
Convex Ents - Convex Ents
Relations, default values, unique fields and more for Convex
Current focus for Convex has been nailing the bottom level of abstractions and the base api
should i use convex-auth?
I'd recommend it personally. Only reason not to is if you have complex auth requirements.
nah, just need roles, and oauth
Roles you can handle in your backend logic, convex functions. Yeah I'd recommend convex auth.
great, and for this
that's all i need? or do i add in regions cities: v.id or v.array?
You don't need to denormalize by default. You may find it helpful depending on how you end up querying your data, though. What you have should be a good starting point.