Design Rationale — Shared

Non-obvious design choices for the shared module — the WHY behind each decision.

Shared (locked 2026-06-09)

Shared tables carry no tenant_id and no RLS — deliberately

Decision: shared tables (country, us_state, currency, unit_of_measure, usda_hardiness_zone, plant, plant_common_name) have no tenant_id column and no RLS policies.

Why: This is universal reference data — identical for all tenants. Tenant-scoping would force every tenant to have their own copy of every US state, currency code, and plant record, which is pointless duplication.

Guard: The absence of tenant_id on shared tables is intentional, not an RLS oversight. Do not add tenant_id to shared tables. If a tenant needs custom reference data (e.g. custom units of measure), that belongs in the owning module's config tables, not in shared.


Deactivation via is_active, not deleted_at

Decision: shared tables use is_active boolean for soft-deactivation rather than the deleted_at pattern used by tenant-scoped tables.

Why: Reference data is never truly deleted; it is retired. is_active = false is semantically cleaner than a nullable timestamp on seed-managed rows. Tenant tables use deleted_at because they participate in the soft-delete RLS pattern; shared tables do not.


Last modified: Jun 17, 2026, 8:37 PM PT
On this page
Esc