Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DB-001DatabaseTenant discriminator column exists for same-schema model
Checks that same-schema multi-tenant tables include tenant discriminator evidence.
errorviolationNo auto-fix
How to fix
- Add the tenant discriminator column where required.
- Update schema artifacts and migrations.
- If the system uses a different tenant isolation model, update the architecture configuration and ADRs.
What the rule validates
A same-schema tenant model is configured, but ArchPilot could not confirm tenant discriminator coverage.
Why it matters
Tenant discriminators are the foundation for keeping tenant data isolated in shared tables.
Common causes
- A table is missing tenantId or equivalent.
- Schema metadata is stale.
- The tenant model setting does not match the database design.
Typical violation example
An orders table is shared across tenants but has no tenant_id column.Typical compliant example
Shared tenant tables include tenant_id and application queries filter by it.Related rules
Adjacent categories
Related files/config
db/sqlpackages/db/prisma/schema.prisma.archpilot/architecture.json
Related CLI commands
archpilot validatearchpilot validate --ci