Bogdanp/deta

How to define foreign keys?

eko234 opened this issue · 3 comments

Hi, I'm looking for a way to define a foreign key constraint in my schemas, is there a way to do it or is out of the scope of this project?

It depends on what you'd like the constraints to do. I'd say constraints to enable things like lazy loading/automatic relationships are out of scope, but if you're just looking to declare constraints such that create-table! can use them, I think those could be worth adding.

Yes I think users would find it very useful, another thing I just found out was that it is not possible to declare multiple primary keys when defining a schema, which is another common use case, using deta has been pretty cool so far, I thank you so much for your work, using it in production right now :).

corpix commented

@eko234 In #59 I've added ability to emit constraints section of the create table statement (after table columns). So, this may become possible :)