-
Notifications
You must be signed in to change notification settings - Fork 1
Description
YearComponents currently have types associated with them, e.g. Equipment, People, etc.
we could add a consistency validation check in referencers, e.g. OccupancyComponent can check that its assigned schedule must be of the relevant YearComponent.Type. This is trivial to do in pydantic, but more difficult to achieve in the database with our current setup. The typical way to achieve this would be with a SQL Check statement, but Prisma does not natively support this in the schema as far as I can tell; we could absolutely add those checks to the migrations folder, but I don't love the idea of having to rely on custom migrations which are not contained in the prisma schema. It look like https://github.com/zenstackhq/zenstack does support checks, which is a superset of prisma, but I'm not sure how I feel about trying to hack that in, as it might pose issues with prisma-client-py. See prisma/prisma#3388 ofr more info.
If this issue is closed without adding the sql consistency check, make a separate issue for that