Task: Initial tenant setup (schema)

Table of Contents

This page documents a task in the Tenancy foundation story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Lay the multi-tenant foundation at the schema level.

Status

Field Value
State DONE
Parent story Tenancy foundation
Now Completed 2026-02-01.
Waiting on None.
Next None.
Last touched 2026-02-01

Acceptance

  • ores_iam_tenant_types_tbl, ores_iam_tenant_statuses_tbl, ores_iam_tenants_tbl (bitemporal).
  • tenant_id on ~70 existing entity tables across assets / dq / geo / iam / refdata / telemetry / variability.
  • Unique indexes + constraints extended with tenant_id; tenant_id indexes added for query performance.
  • INSERT triggers call ores_iam_validate_tenant_fn to reject invalid or inactive tenants.
  • Upsert functions take tenant_id as the first parameter.
  • System tenant has a well-known UUID; SuperAdmin + TenantAdmin roles introduced.
  • Session-tenant lookup functions (ores_iam_current_tenant_id_fn, ores_iam_lookup_tenant_by_hostname_fn).

Plan

Captured during execution; cleared into the parent story on close.

Notes

One PR (#395) handled the schema; subsequent PRs in this story handled seeding and triggers.

Result

Schema is multi-tenant aware end-to-end.

Emacs 29.1 (Org mode 9.6.6)