# Database Notes

## Standalone model

V1 and V2 use one standalone RBE database for application identity, roles and operating data.

Core identity/auth tables include:

- `rbe_users`
- `rbe_roles`
- `login_tokens`

Authentication does not require an unrelated member database.

## RC1 validation database

RC1 contains:

```text
rbe_handover_RC1_VALIDATION.sql
```

This is the latest corrected **shortened validation database** used during handover preparation and clean-server testing. It contains the current standalone authentication/schema corrections, including resolved role/user integrity.

It is not the final full historical operational export.

## RC1 integrity state

The RC1 database has been checked so that all `rbe_roles.user_id` values have a corresponding `rbe_users.id` row. A stale duplicate/orphan agent role was removed during preparation.

The `vw_meters_combined` view in the RC1 copy is exported without a former-server DEFINER and uses `SQL SECURITY INVOKER` for destination portability.

## Final delivery database

After the RC1 clean-server test passes, the validation SQL must be replaced by a fresh full RBE database export containing the agreed RBE-specific operational schema/data and historical meter data required for the delivered operating copy.

The final delivery database must not carry excluded former-server credentials/private tokens.
