postgresql-schema-design
CommunityPostgreSQL schema patterns for multi-tenant apps
System Documentation
What problem does it solve?
PostgreSQL 18 schema design patterns for multi-tenant microservice platforms. Defines standard table template with id, timestamps, soft delete, and optimistic locking. Covers data type selection (UUID v7 for primary keys, TIMESTAMPTZ not TIMESTAMP, JSONB for flexible fields), indexing strategy (B-tree for equality/range lookups, GIN for JSONB and tsvector full-text search, partial indexes for soft-delete filtering), table partitioning criteria, COMMENT ON conventions for documentation, and snake_case naming conventions. Targets PostgreSQL 18 on AWS Aurora with schema-per-tenant isolation and tenant-aware connection routing.
Core Features & Use Cases
- Standard table template: id UUID, created_at/updated_at TIMESTAMPTZ, is_deleted, version for optimistic locking.
- Data types and indexing guidance: UUIDs, TIMESTAMPTZ, JSONB with GIN indexes, partial indexes for soft-delete.
- Documentation and naming conventions: COMMENT ON for tables/columns, snake_case, and per-tenant isolation notes.
Quick Start
Design a per-tenant PostgreSQL schema using these conventions for a new microservice.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: postgresql-schema-design Download link: https://github.com/PremModhaOfficial/motadata-ai-pipeline/archive/main.zip#postgresql-schema-design Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.