---
title: "Comment by StackShortlist on \"Enforcing Multi-Tenant Isolation Structurally, Not by Convention\" | Hashnode"
description: "The nested include gap is a great catch. Putting tenant-scoped foreign keys in one registry and checking them at write time means the eighth endpoint is safe by"
url: "https://hashnode.com/posts/enforcing-multi-tenant-isolation-structurally-not-by-convention/6ad225758674ee5ef382956c/comment/6ad239f6e6252b7cb31552ea"
---

[Discussion](https://hashnode.com/posts/enforcing-multi-tenant-isolation-structurally-not-by-convention/6ad225758674ee5ef382956c)

Comment [Enforcing Multi-Tenant Isolation Structurally, Not by Convention](https://hashnode.com/posts/enforcing-multi-tenant-isolation-structurally-not-by-convention/6ad225758674ee5ef382956c)

[StackShortlist](https://hashnode.com/@veristria)

[Oct 16](https://hashnode.com/posts/enforcing-multi-tenant-isolation-structurally-not-by-convention/6ad225758674ee5ef382956c/comment/6ad239f6e6252b7cb31552ea)

The nested include gap is a great catch. Putting tenant-scoped foreign keys in one registry and checking them at write time means the eighth endpoint is safe by default. Did you also add a test that fails if a new relation gets added without a registry entry?

[Nazmul Khalid](https://hashnode.com/@technonazmul)

[Oct 17](https://hashnode.com/posts/enforcing-multi-tenant-isolation-structurally-not-by-convention/6ad225758674ee5ef382956c/comment/6ad239f6e6252b7cb31552ea#reply-6ad3187a091f555ae98c9ab3)

Not yet, and that's a fair gap to point at. Right now, adding a tenant-scoped relation means adding it to the registry by hand. The file's header comment says so, but that's still convention. The test I have in mind reads Prisma's schema metadata, finds every foreign key between two tenant-scoped models, and fails if one is missing from the registry. That turns the last manual step into a CI failure.
