Skip to main content
The Membership entity represents a personโ€™s membership in a workspace within the Well system. It serves as the central linking table for the multi-tenancy system, allowing a user to belong to multiple workspaces with different roles.

Table structure

Table name: memberships

Main fields

NameTypeRequiredConstraintsAllowed ValuesDescriptionExample
idstring, UUID, ๐Ÿ”’ systemโœ… YesUnique identifier (read-only)โ€“Unique identifier of the membership previously createdโ€membership-uuid-123โ€
personPeople (UUID)โœ… YesForeign key referenceโ€“Reference to the personโ€person-uuid-456โ€
workspaceWorkspace (UUID)โœ… YesForeign key referenceโ€“Reference to the workspaceโ€workspace-uuid-789โ€
firebase_idstringโšช Nonullableโ€“Firebase user ID for authenticationโ€firebase-user-id-123โ€
membership_rolestringโšช Nonullableadmin, member, viewer, ownerUser role in the workspaceโ€adminโ€
created_atstring (ISO 8601) ๐Ÿ”’ systemโ€“auto timestampโ€“Creation timestampโ€2023-01-01T12:00:00Zโ€
updated_atstring (ISO 8601) ๐Ÿ”’ systemโ€“auto timestampโ€“Last updated timestampโ€2024-01-01T12:00:00Zโ€
deleted_atstring | null ๐Ÿ”’ systemโšช Nonullable ISO 8601โ€“Deletion timestamp (soft delete)โ€œ2024-01-01T12:00:00Zโ€

Relations

The Membership entity is a Many-to-Many linking table between People and Workspace:

Many-to-One relations

  • People: The member person (one membership โ†’ one person)
  • Workspace: The workspace (one membership โ†’ one workspace)

Relationship schema

People (1) โ†โ†’ (N) Membership (N) โ†โ†’ (1) Workspace

# Enables Many-to-Many relationship:
People (N) โ†โ†’ (N) Workspace via Membership