← All tutorials
✍️
ChatGPT (Manual) · SQL + PostgreSQL
Design a Database with ChatGPT
Prerequisites
- ✓ A ChatGPT account (free or Plus)
- ✓ PostgreSQL installed (or any SQL database)
- ✓ Git installed
- ✓ Qmmit installed
- ✓ A Qmmit account with CLI token
1
Create the project
Set up a project for your database schema.
mkdir db-schema cd db-schema git init echo "# Database Schema" > README.md git add . && git commit -m "initial commit"
2
Set up Qmmit
Initialize tracking.
qmmit init
3
Ask ChatGPT to design the schema
Go to chat.openai.com and ask ChatGPT to design your database. Since ChatGPT is a web tool, it does not save local files. You will log the prompt manually.
# In ChatGPT web: # "Design a PostgreSQL schema for a SaaS app with: # - Users (email, password_hash, plan, created_at) # - Teams (name, slug, owner_id) # - Projects (name, team_id, created_at) # - Invoices (team_id, amount, status, due_date) # Include foreign keys, indexes, and constraints." # Then in your terminal, log the prompt: qmmit add "Design a PostgreSQL schema for a SaaS app with Users, Teams, Projects, and Invoices" --model chatgpt-4o
💡
The prompt is buffered locally. It will be linked to your next commit automatically. You do not need to copy the AI response — only your prompt.
4
Copy the SQL and save it
Copy the SQL that ChatGPT generated and save it to a file.
# Create schema.sql with the ChatGPT output # (paste the SQL into the file) # Also log the second prompt: qmmit add "Write SQL migration to add audit_log table with user_id, action, target, timestamp" --model chatgpt-4o
5
Commit
Commit everything. Both manual prompts get linked to this commit.
git add . git commit -m "feat: database schema with migrations" # Expected: # [qmmit] 2 prompt(s) tracked → vwx9012 qmmit show HEAD # Should show both ChatGPT prompts linked to this commit
⚡
What Qmmit does here
Flushes the 2 buffered manual prompts, stamps them with the commit SHA, stores in local DB.
6
Push and verify
Push and check your dashboard.
git push -u origin main # Check: qmmit.dev/yourusername # Should show: db-schema project, 2 prompts, chatgpt-4o model, ✍manual source tag