You can describe a SaaS billing app in English, get tables and foreign keys back, and inspect the result as an interactive ERD, without drafting SQL migrations first. This walkthrough uses a small, realistic schema (users, plans, subscriptions) and the conversational AI schema designer in tofudb.
The same flow applies to any domain you pick at project creation (SaaS, e-commerce, finance, and so on). The point is the loop: prompt → tables and FKs → visual ERD → review the diff → commit.
The prompt
Start a project, choose Fresh Database (no CSV import), and describe the app:
I need a SaaS billing database. Users sign up with email. Each user can subscribe to one plan at a time. Plans have a name, monthly price, and a billing interval. Subscriptions track status (trialing, active, canceled), the start date, and when the current period ends. I also need a simple invoices table: amount, issued date, and which subscription it belongs to.
You do not need to name columns. The designer infers users, plans, subscriptions, and invoices, plus the foreign keys that make “one plan at a time” and “invoice belongs to a subscription” true.
The tables you should expect
A reasonable first draft looks like this:
users
id(primary key)email(unique)created_at
plans
idnamemonthly_pricebilling_intervalcreated_at
subscriptions
iduser_id→users.idplan_id→plans.idstatusstarted_atcurrent_period_end
invoices
idsubscription_id→subscriptions.idamountissued_at
That is enough to answer “which plan is this user on?” and “what did we invoice last month?” without extra join tables. If the prompt had said “users can hold several active subscriptions,” the designer should not unique user_id on subscriptions. Say that constraint in English if it matters.
Inspect it on the ERD
Open the interactive ERD for the project. You should see four nodes and three relationship edges:
subscriptions.user_id→userssubscriptions.plan_id→plansinvoices.subscription_id→subscriptions
Trace a foreign key by selecting an edge. If invoices accidentally points at users instead of subscriptions, that is visible immediately, which is why you look at the diagram before you commit. The ERD is a graph explorer for the live draft schema (tables, columns, FKs), not a separate drawing tool.
From the same project you can switch to the spreadsheet-style sheet grid and sanity-check column types, or stay on the ERD and ask the designer for a change:
Add a
canceled_attimestamp on subscriptions, nullable.
The change lands as a draft. tofudb shows a visual schema diff; you inspect the table, column, and relationship edits, then commit to the live instance. AI-initiated schema changes are not applied until you review them.
What to check before you commit
- Primary keys exist on every table the prompt implied.
- Foreign keys match the sentences you wrote (“invoice belongs to a subscription,” not to a user).
- Uniqueness matches the product rule (one active subscription per user, unique email).
- Types for money and dates (
monthly_price,issued_at) look like numeric and timestamp columns, not free text. - Names are stable enough that NLQ questions (“active subscriptions last week”) will resolve.
If something is wrong, stay in the conversation. “Rename billing_interval to interval_months and store an integer” is cheaper than a hand-written migration at this stage.
A follow-up prompt that usually pays off
After the first draft, ask for the operational columns you forgot:
Add
updated_aton every table. On invoices, add astatusof draft, open, or paid.
That is still schema work, not data work. Review the unique flags in the diff: a unique user_id on subscriptions blocks a canceled row plus a new trial. If that is not the product rule, send it back. The ERD shows tables and foreign keys; column uniques are easier to confirm in the schema diff.
Query it in English after it is live
Once the schema is committed, NLQ can ask questions against those tables:
- “How many subscriptions are trialing?”
- “List users whose current period ends this week.”
- “Total invoice amount by plan name.”
Ask those in NLQ and export the result as CSV if you need a file.
This is the full loop the homepage describes: schema from English, ERD you can inspect, then natural language SQL on that database.