deta icon indicating copy to clipboard operation
deta copied to clipboard

How to define foreign keys?

Open eko234 opened this issue 4 years ago • 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?

eko234 avatar May 31 '21 21:05 eko234

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.

Bogdanp avatar Jun 01 '21 06:06 Bogdanp

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 :).

eko234 avatar Jun 01 '21 14:06 eko234

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

corpix avatar Jul 28 '23 22:07 corpix