-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement basic table-level constraints/validation #20
Comments
ref other packages that facilitate key handling |
EDIT: note that this comment is out of date in a post-Legolas v0.5 world FWIW, my plan here API-wise is for So:
|
wonder if there should be a separate notion of "check constraints" for schema authors to express besides just normal per-field RHS stuff. could imagine extending the macro: @row(name,
fields...,
@check begin
...
end) then the check constraints could be invoked as part of one of the |
I wonder how crazy it would be to add actual primary/foreign key relations to Legolas: @row(name,
@primary(pkey::UUID),
@foreign(fkey, "other-schema@2"),
other_fields...,
@check begin
...
end) we'd be entering full relational IDL territory...things could get wacky. We could try to be pretty restrictive on what's supported, though; for example, not supporting composite keys + forcing referenced foreign keys to be actual primary keys (not just candidate keys). we could expand this later if we wanted |
xref #69 for a solid sketch of what convenient record-level check constraints could look like in a post-Legolas-v0.5 world |
The most basic of which is a primary key relationship. Note that we actually originally decided not to have constraints in Legolas simply because we figured spelling e.g.
allunique(my_table.my_primary_key_column)
was sufficient (and likewise forissubset
to test foreign key relations), but given that this is already emerging as useful downstream functionality, I think we might as well just have fully generic versions supported by the package.The text was updated successfully, but these errors were encountered: