RJ
RJ•3y ago

Are foreign key constraints a thing in

Are foreign key constraints a thing in Convex? What are the plans in general (if any) for supporting constraint definition on schemas?
2 Replies
alexcole
alexcole•3y ago
No constraints yet! You can implement them yourself by running checks as part of a mutation (for example checking if a document already exists with a given name before creating a new one). This works in Convex unlike most other DBs because we provide true serializability (https://docs.convex.dev/understanding/deep-dive/occ). In terms of the future, we're open to feedback here! We don't have plans to add them in the near term, but if building this type of thing yourself feels too verbose or error-prone, let us know and we can rethink the priority.
RJ
RJOP•3y ago
Cool, thanks! I'll report back with more specific feedback based on my experience 🙂

Did you find this page helpful?