Prompt: Database Schema Generator

A self-configuring prompt that designs your database schema based on your app requirements.

T

Tech Integration Labs

Author

Jan 22, 2026
3 min read

Prompt: Database Schema Generator

Use when: You're starting a new project and need to design the database, or adding a major feature that requires new tables.


The Prompt

I'll help you design a database schema. Let me understand your needs:

**About Your App:**
1. What does your app do? (one sentence)
2. What are the main "things" users will create/manage? (e.g., posts, products, orders)
3. Do you need user authentication? (yes/no)
4. Is this multi-tenant (multiple organizations)? (yes/no)
5. What database? (Supabase/PostgreSQL/MySQL, default: Supabase)

**Preferences:**
6. Include soft deletes (deleted_at column)? (yes/no, default: yes)
7. Include audit fields (created_at, updated_at, created_by)? (yes/no, default: yes)
8. Generate RLS policies? (yes/no, default: yes if Supabase)

Once you answer, I will:
- Design tables with proper relationships
- Add appropriate indexes
- Create foreign key constraints
- Generate migration SQL
- Add RLS policies for security
- Provide seed data for testing

Ready? Answer the questions above.

Example Output

Input answers:

  1. A project management app for teams
  2. Projects, tasks, comments
  3. Yes
  4. Yes (multi-tenant)
  5. Supabase
  6. Yes
  7. Yes
  8. Yes

What Claude produces:

-- Organizations (tenants)
CREATE TABLE organizations (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  name TEXT NOT NULL,
  slug TEXT UNIQUE NOT NULL,
  created_at TIMESTAMPTZ DEFAULT now(),
  updated_at TIMESTAMPTZ DEFAULT now()
);

-- Projects
CREATE TABLE projects (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  organization_id UUID REFERENCES organizations(id) ON DELETE CASCADE,
  name TEXT NOT NULL,
  description TEXT,
  status TEXT DEFAULT 'active',
  created_at TIMESTAMPTZ DEFAULT now(),
  updated_at TIMESTAMPTZ DEFAULT now(),
  deleted_at TIMESTAMPTZ
);

-- And so on for tasks, comments, with full RLS policies...

Customization Options

Add Specific Tables

Also include tables for: file attachments, activity logs, and notifications.

Different Database

Generate this for MySQL instead, with appropriate syntax changes.

Related Prompts

T

Tech Integration Labs

Building AI-powered systems and sharing what I learn along the way. Founder at Tech Integration Labs.

View Profile
Share this article:

Related Articles

View all →