data-schema-design

Solid

PostgreSQL schema design including migration strategy and cross-ORM migration tooling (Prisma, Drizzle, Kysely, Django, golang-migrate), retention policy design, index strategy, keyset pagination, queue-claim patterns, disaster recovery DDL, SECURITY DEFINER safety, RLS policy patterns and RLS performance, naming conventions, and cross-engine notes for MySQL/MariaDB. Use when creating or modifying database tables, writing SQL migrations, planning zero-downtime rollouts, designing RLS policies, planning data retention, adding indexes, reviewing schema security, or troubleshooting query performance. Also use when the user mentions "schema", "DDL", "migration", "RLS", "retention", "index", "table", "enum", "pagination", "MySQL", "MariaDB", or "database design".

API & Backend 3 stars 0 forks Updated today MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
20
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Data Schema Design This skill assumes PostgreSQL (including Supabase's PostgreSQL). For other databases, adapt the specifics but the principles transfer. ## Fail-Fast Rule If a migration could cause data loss, **stop and require explicit confirmation**. Never drop columns or tables without a backup plan. Never alter enum types in a way that invalidates existing rows. Never run destructive DDL in production without testing on a branch first. ## Cardinal Rule **Every table in production must have a DDL file in the `sql/` directory.** If a table exists in the database but has no DDL, it is undocumented technical debt. Schema-as-code is the only way to recover from disaster. Audit periodically to catch drift between production and the `sql/` directory. ## Audit Baseline: Current State ### Existing DDL Files (sql/ directory) | File | Tables Covered | |------|---------------| | `core_tables.sql` | Foundational domain tables for the project | | `billing_tables.sql` | Billing / subscription / webhook audit tables | | `external_data_tables.sql` | Tables for ingested third-party data | | `retention_policies.sql` | `run_retention_cleanup()` function | | `retention_summary_tables.sql` | Daily summary / rollup tables | | `security_fixes.sql` | RLS/function fixes (no new tables) | | `rls_fixes.sql` | RLS policy fixes (no new tables) | ### Tables WITHOUT DDL (missing — identified in audit) Run the audit query (see *Disaster Recovery*) to list tables in production that have no co...

Details

Author
Canhada-Labs
Repository
Canhada-Labs/ceo-orchestration
Created
4 weeks ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

API & Backend Listed

postgres-schema-design

Design a new PostgreSQL schema from domain invariants and workloads, covering keys, types, nullability, constraints, relationships, tenancy, ownership, RLS, partitioning, index intent, and evolution. Use when creating or substantially reshaping a data model. Do not use for auditing an already deployed schema, diagnosing one slow query, or executing a production migration.

1 Updated today
genaptic
API & Backend Listed

dbdesign

Design and review production database schemas, data models, ERDs, migration plans, and storage patterns. Use for OLTP schema design, OLAP/star-schema modeling, fact/dimension tables, indexes, constraints, partitioning, multi-tenant data models, CSV/JSON-to-table design, schema review, migration risk review, and database design documents across PostgreSQL, MySQL, SQLite/D1, BigQuery, and MongoDB. Does not execute DDL by default.

2 Updated today
vanducng
AI & Automation Solid

pg-migration

PostgreSQL schema migration safety reviewer and DDL generator. ALWAYS use when writing, reviewing, or planning PostgreSQL schema changes — ALTER TABLE, CREATE/DROP INDEX, column type changes, constraint additions, RLS policy changes, or any DDL touching production tables. Covers lock-level analysis, CREATE INDEX CONCURRENTLY, NOT VALID constraint patterns, transactional DDL rollback, pg_repack for table rewrites, phased rollout design, and backward compatibility. Use even for "simple" ADD COLUMN — PostgreSQL DDL lock behavior varies by operation and version, and AccessExclusiveLock on a hot table causes immediate outage.

27 Updated yesterday
johnqtcg