Blog/SaaS & Startups

SaaS Data Model Design: Early Decisions That Save Painful Rewrites

Get the core data model decisions right early: entities, identifiers, money, time, history and deletion, so new features do not need schema surgery.

By Sagar Makker · 7 min read · October 2026
Coding Programming
In short
Model the real business entities and relationships, not just the first screen you are building.
Decide early how you store money, time, identifiers and history, and apply it everywhere.
Write a short data model guide and review new tables against it.
The problem

This is for CTOs and founding engineers designing a new SaaS product or untangling an early schema that is starting to hurt. Weak data model choices rarely fail on day one; they show up later as reporting that cannot be trusted, invoices that are off by small amounts and features that need months of migration. This post covers the core decisions to make deliberately, a short data model guide and a review habit that keeps the schema healthy.

A SaaS product stored a customer's address directly on each invoice row, prices as floating point numbers and dates in server time. Two years later, finance asks for revenue by state for GST reporting, and support asks why some invoices are off by a paisa. The data needed is either missing, inconsistent or tied to the wrong time zone for customers abroad.

Early schemas are usually designed around the first screens, under deadline pressure. One person's choices become permanent, and there is no written guidance for the next engineer. Different tables handle money, time, deletion and history differently. Each new feature, report or integration then requires careful archaeology, workarounds and risky migrations that could have been avoided with a few deliberate early decisions.

Why it happens
01Tables are designed around screens rather than real business entities
02Money stored as floating point, or without currency, causing rounding errors
03Timestamps stored without time zone, or mixed between local and UTC
04Records are overwritten or hard deleted, losing history needed for audits
05No written data model conventions, so every engineer invents their own
How to fix it
1
Map core business entities first
The CTO and product manager list core entities such as account, user, customer, plan, subscription and invoice, with their relationships, before designing tables. Validate the map against real customer workflows and planned features.
2
Standardise money, time and IDs
The tech lead sets conventions: money as integer minor units or fixed decimals with a currency code, timestamps in UTC with a stored user time zone, and stable non-guessable IDs for public references.
3
Decide history and deletion rules
For records that matter legally or financially, such as invoices, prices and permissions, the tech lead decides between append-only history, audit tables or soft deletes. Check retention and erasure obligations with your compliance team.
4
Snapshot data on financial documents
Engineers store a copy of key details, such as billing address, tax registration and prices, on invoices and orders at the time of creation, so later edits to the customer record never change past documents.
5
Write a guide and review tables
The tech lead keeps a short data model guide covering these conventions. Any pull request adding or changing tables gets a review against the guide from a designated reviewer before merging.
Worked example
An accounting SaaS fixes its schema foundations

An early-stage accounting SaaS in Kolkata found that invoice totals occasionally differed from customer ledgers by tiny amounts, and changes to a customer's GSTIN altered old invoices. The tech lead wrote a short data model guide: money in integer minor units with currency, timestamps in UTC with stored time zones, and snapshots of billing details on every invoice. New tables were reviewed against the guide, and existing invoice data was migrated in stages using expand and contract. Rounding complaints stopped, historical invoices stayed fixed after customer edits, and new reports for finance could be built without manual corrections.

Common mistakes
×
Storing money as floating point numbers
Floating point arithmetic causes small rounding errors that pile up in invoices and reports. Store amounts as integer minor units or fixed-precision decimals with a currency code.
×
Letting edits rewrite financial history
If invoices reference live customer data, edits change past documents. Snapshot the relevant details at creation so issued documents stay exactly as they were.
×
Designing tables around the first screen
Screens change quickly, while data lives for years. Model real entities and relationships first, then build screens and APIs on top of them.
Where an AI agent helps
Input
Proposed schema changes, the data model guide and existing table definitions
Agent does
An agent on XDQ AgentOS checks new tables against the guide and flags money, time or history issues
Human gate
Designated reviewer approves the schema change before it is merged
Outcome
Review notes with specific convention breaches and suggested fixes
Checklist
Map core business entities and relationships
Store money as minor units or fixed decimals with currency
Store timestamps in UTC and keep user time zones
Decide history and deletion rules for financial records
Snapshot billing details on invoices and orders
Review every schema change against a written guide
What to measure
Schema changes reviewed against the guide
Data fixes needed per month
Reports needing manual correction
Tables breaching money or time rules
Questions
Should we use soft deletes or hard deletes?

Use soft deletes or history tables where you need audit trails or recovery, such as invoices and permissions. Use hard deletes, or anonymisation, where data protection rules require erasure. Check DPDP Act obligations with your compliance team.

How should we store money in a SaaS database?

Store amounts as integers in the smallest currency unit, such as paise, or as fixed-precision decimals, always with a currency code. Never use floating point types for money, because rounding errors accumulate.

Should we use UUIDs or sequential IDs?

Many teams use sequential IDs internally for performance and non-guessable IDs such as UUIDs for anything exposed in URLs or APIs. Whatever you choose, apply it consistently and never expose IDs that reveal business volumes.

How do we fix a data model that is already causing problems?

List the specific pain points, agree target conventions in a short guide, apply them to all new tables immediately, and migrate the most painful existing tables in stages using expand and contract rather than one big rewrite.

Keep reading
All posts →
Coding ProgrammingSaaS & Startups
Zero-Downtime Database Migrations: A Safe Process for SaaS Teams
7 min readRead →
Business WorkingSaaS & Startups
Observability Basics for Early-Stage SaaS: Logs, Metrics and Alerts
7 min readRead →
Team MeetingSaaS & Startups
API Versioning Strategy for SaaS: Change Without Breaking Customers
7 min readRead →
Next step

Want this fixed in your business?

Send the workflow. You get a scope and a fixed price within two working days — or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com