Template: Database Schema Documentation Template

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

FieldExample (B2B SaaS)Example (B2C App)
Database Nameonboarding_dbecoclean_app_db
Engine/TypePostgreSQL 14Firestore (NoSQL)
OwnerBackend Team AMobile API Team
VersioningLiquibase Migration v12Firestore Rules v2

Section 2 – Entities / Collections

Entity/TablePurposeExample (SaaS)Example (B2C)
usersStore user accountsid, email, password, roleuid, email, phone, role
companiesStore org detailsid, name, plan_typeN/A
bookingsStore service bookingsN/Abooking_id, user_id, date, status
paymentsTrack paymentstxn_id, user_id, amounttxn_id, booking_id, amount

Section 3 – Fields Definition

Table/CollectionFieldTypeConstraintsExample
usersidUUIDPrimary Keyd33f…
usersemailVARCHAR(255)Unique, Not Nulltest@abc.com
userspasswordHASHNot Null****
bookingsbooking_idUUIDPrimary Keya12b…
bookingsstatusENUM(active,cancelled,completed)Default=activeactive

Section 4 – Relationships

SourceTargetTypeCardinalityNotes
users.idcompanies.idFKMany-to-OneA user belongs to a company
users.idbookings.user_idFKOne-to-ManyUser can have many bookings
bookings.booking_idpayments.booking_idFKOne-to-OneEach booking has one payment

Section 5 – Indexing & Performance

TableField(s)Index TypePurpose
usersemailUnique IndexFast login lookup
bookingsuser_id, dateComposite IndexQuery bookings per user per date
paymentstxn_idUnique IndexEnsure transaction uniqueness

Section 6 – Data Governance

AspectStandard
PII StorageEncrypt sensitive fields (email, phone)
RetentionArchive data older than 2 years
ComplianceGDPR: data deletion on request
BackupDaily snapshots + point-in-time recovery
Access ControlRead-only for QA, full for DevOps/DBA

Blank Reusable Template

Database Metadata

FieldEntry
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 |