Purpose
To provide a standardized template for documenting database schemas, ensuring developers, QA, and analysts have a clear, up-to-date reference for entities, relationships, constraints, and data governance.
Scope
- Applies to all SQL and NoSQL databases.
- Used by Developers, DBAs, Architects, and QA Engineers.
- Covers tables/collections, fields, types, constraints, relationships, and indexing.
Structure
Section 1 – Database Metadata
| Field | Example (B2B SaaS) | Example (B2C App) |
| Database Name | onboarding_db | ecoclean_app_db |
| Engine/Type | PostgreSQL 14 | Firestore (NoSQL) |
| Owner | Backend Team A | Mobile API Team |
| Versioning | Liquibase Migration v12 | Firestore Rules v2 |
Section 2 – Entities / Collections
| Entity/Table | Purpose | Example (SaaS) | Example (B2C) |
| users | Store user accounts | id, email, password, role | uid, email, phone, role |
| companies | Store org details | id, name, plan_type | N/A |
| bookings | Store service bookings | N/A | booking_id, user_id, date, status |
| payments | Track payments | txn_id, user_id, amount | txn_id, booking_id, amount |
Section 3 – Fields Definition
| Table/Collection | Field | Type | Constraints | Example |
| users | id | UUID | Primary Key | d33f… |
| users | VARCHAR(255) | Unique, Not Null | test@abc.com | |
| users | password | HASH | Not Null | **** |
| bookings | booking_id | UUID | Primary Key | a12b… |
| bookings | status | ENUM(active,cancelled,completed) | Default=active | active |
Section 4 – Relationships
| Source | Target | Type | Cardinality | Notes |
| users.id | companies.id | FK | Many-to-One | A user belongs to a company |
| users.id | bookings.user_id | FK | One-to-Many | User can have many bookings |
| bookings.booking_id | payments.booking_id | FK | One-to-One | Each booking has one payment |
Section 5 – Indexing & Performance
| Table | Field(s) | Index Type | Purpose |
| users | Unique Index | Fast login lookup | |
| bookings | user_id, date | Composite Index | Query bookings per user per date |
| payments | txn_id | Unique Index | Ensure transaction uniqueness |
Section 6 – Data Governance
| Aspect | Standard |
| PII Storage | Encrypt sensitive fields (email, phone) |
| Retention | Archive data older than 2 years |
| Compliance | GDPR: data deletion on request |
| Backup | Daily snapshots + point-in-time recovery |
| Access Control | Read-only for QA, full for DevOps/DBA |
Blank Reusable Template
Database Metadata
| Field | Entry |
| Database Name | |
| Engine/Type | |
| Owner | |
| Versioning |
Entities / Collections
| Entity/Table | Purpose |
Fields Definition
| Table/Collection | Field | Type | Constraints | Example |
Relationships
| Source | Target | Type | Cardinality | Notes |
Indexing & Performance
| Table | Field(s) | Index Type | Purpose |
Data Governance
| Aspect | Standard |