Skip to content

Tenant Management System

Vijay Khollam edited this page May 6, 2024 · 1 revision

Problem Statement

Each Tenant potentially used for different programs. The system must handle tenant-specific configurations. Moreover, each tenant has associated relationships with users, cohorts, fields, and roles within the system. This integration is crucial for maintaining a cohesive system architecture where all components are consistently synchronised and effectively managed.

Development Plan

  • API Integration: Develop APIs that manage CRUD operations on the tenants table.

Description

The Tenants table stores information about tenants in the system.

DB Design

Name Data Type Constraints Description
tenant_id uuid PRIMARY KEY Unique identifier for the tenant.
name varchar(255) UNIQUE, NOT NULL The name of the tenant.
domain varchar(255) UNIQUE, NOT NULL The domain associated with the tenant.
created_at timestamp with time zone NOT NULL, DEFAULT The date and time the tenant was created.
updated_at timestamp with time zone NOT NULL, DEFAULT The date and time the tenant was last updated.
params JSONB Handle tenant-specific configurations.

User Tenant Mapping

Column Name Data Type Description Default Value Constraints Indexes
Id uuid Unique identifier for the mapping gen_random_uuid() PRIMARY KEY Primary Index
tenantId uuid Identifier linking to the tenant None FOREIGN KEY, NOT NULL Foreign Key Index
userId uuid Identifier linking to the user None FOREIGN KEY, NOT NULL Foreign Key Index
createdBy uuid Identifier of the user who created this record None
updatedBy uuid Identifier of the user who last updated this record None
createdAt timestamp with time zone Timestamp when the record was created now() NOT NULL
updatedAt timestamp with time zone Timestamp when the record was last updated now() NOT NULL