core PK: id 8 required 1 unique

Description

Junction entity linking users to organizations with role context, defining a user's membership status, role, and access scope within a specific organization in the multi-tenant Meander platform.

16
Attributes
5
Indexes
8
Validation Rules
17
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key for the membership record
PKrequiredunique
user_id uuid Foreign key referencing the user
required
organization_id uuid Foreign key referencing the organization
required
role enum The user's role within this organization
required
status enum Membership status — active, paused, or deactivated
required
is_primary boolean Whether this is the user's primary organization (NHF users can belong to up to 5 local associations)
required
invited_at datetime When the invitation was sent to this user for this organization
-
joined_at datetime When the user accepted the invitation and became an active member
-
deactivated_at datetime When the membership was deactivated
-
paused_at datetime When the peer mentor set their status to paused
-
pause_reason text Optional reason provided when pausing membership
-
invited_by_user_id uuid The org admin or coordinator who sent the invitation
-
support_access_granted_until datetime Time-bounded global admin support access expiry for this org membership context
-
metadata json Extensible bag for org-specific membership attributes (e.g. local association IDs for NHF multi-local-association membership)
-
created_at datetime Record creation timestamp
required
updated_at datetime Record last-updated timestamp
required

Database Indexes

idx_uom_user_org_unique
btree unique

Columns: user_id, organization_id, role

idx_uom_user_id
btree

Columns: user_id

idx_uom_organization_id
btree

Columns: organization_id

idx_uom_status
btree

Columns: organization_id, status

idx_uom_role_org
btree

Columns: organization_id, role

Validation Rules

valid_user_reference error

Validation failed

valid_organization_reference error

Validation failed

no_duplicate_membership error

Validation failed

valid_role_enum error

Validation failed

valid_status_enum error

Validation failed

pause_requires_active error

Validation failed

resume_requires_paused error

Validation failed

invited_by_must_be_org_admin error

Validation failed

Business Rules

single_role_per_org
on_create

A user may hold only one role per organization. Changing role requires updating the existing membership, not creating a new one.

multi_org_allowed
on_create

A user may be a member of multiple organizations (up to 5 for NHF local associations), each with their own role and status.

global_admin_no_org_membership
on_create

Global admins authenticate without an organization context and do not hold standard org memberships. They gain time-bounded access via support_access_granted_until, not via a normal membership record.

coordinator_pauses_peer_mentor
on_update

When a peer mentor's membership is paused, the coordinator for that organization must be notified via the notification system.

certification_expiry_auto_pause
on_update

When a peer mentor's certificate expires, their membership status is automatically set to paused and they are removed from coordinator-visible active lists.

deactivation_cascades_sessions
on_update

When a membership is deactivated, all active sessions for that user within that organization's context must be invalidated.

invite_only_creation
on_create

Membership records may only be created via admin invitation flow. Self-registration is not permitted; users cannot join organizations without an org admin invite.

support_access_time_bounded
always

Global admin support access granted via support_access_granted_until must not extend indefinitely. Expiry is enforced at the session level; every access event is written to the org audit log.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage