<!-- Source: @site/projects/sqlens-for-laravel/docs/rules/cap-l0-tenancy-reference-missing.md -->
<!-- Canonical: https://docs.pushery.com/sqlens-for-laravel/rules/cap-l0-tenancy-reference-missing/ -->

# CAP.L0.TENANCY_REFERENCE_MISSING — tenancy is `explicit` and no reference tenant is named

> The project answered the question and stopped halfway. The run needs to know which tenant the report is about.

- **Category:** safety
- **Level:** 0
- **Stability:** stable
- **Suites:** audit

`sqlens.audit.tenancy.mode` is `explicit` and no reference tenant is named.

## Why this is its own notice

It is a different state from a project that has not answered the question at all. Telling a project
that has already set `explicit` that it "looks multi-tenant" would describe a discovery it made
before you did. This one says the specific thing that is missing.

## What the reference tenant is for

An audit over several tenant databases is not a single statement. Naming one says: *this report is
about this tenant's schema, and the others are assumed to match it*. The header prints that name, so
a finding is never read as applying to all of them.

## What to do

```php
// config/sqlens.php
'audit' => [
    'tenancy' => [
        'mode' => 'explicit',
        'reference' => 'tenant_reference',
    ],
],
```

Pick a tenant whose schema is the one migrations are written against — usually a reference or
template database rather than a customer's.

## Related

- [The audit suite](https://docs.pushery.com/sqlens-for-laravel/audit.md)
- [Tenancy not declared](https://docs.pushery.com/sqlens-for-laravel/rules/cap-l0-tenancy-not-declared.md)
