By Sagar Shankaran, Founder of CallSphere
Prisma owns the schema model, Atlas owns the migration plan, lint, and CI/CD. Together you get declarative schema, automatic diff plans, and zero-downtime production deploys for AI-heavy Postgres.
Key takeaways
TL;DR — Prisma's built-in migrations work for solo devs; Atlas handles the production-grade pipeline (linting, CI checks, RLS, triggers, declarative drift detection). Run Prisma for the schema, Atlas for the plan and apply.
A repo where schema.prisma is the single source of truth, Atlas auto-generates SQL migrations, lint rules block dangerous changes (DROP COLUMN without IF EXISTS, missing CONCURRENTLY, etc.), and GitHub Actions applies them safely.
// schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Conversation {
id BigInt @id @default(autoincrement())
tenantId String @map("tenant_id") @db.Uuid
agentId String @map("agent_id") @db.Uuid
body String
embedding Unsupported("vector(1536)")?
createdAt DateTime @default(now()) @map("created_at")
@@map("conversations")
@@index([tenantId, createdAt(sort: Desc)])
}
flowchart LR
DEV[Edit schema.prisma] --> DIFF[atlas migrate diff]
DIFF --> SQL[Generated SQL]
SQL --> LINT[atlas migrate lint]
LINT --> CI[GitHub Actions]
CI --> STAGE[Staging apply]
STAGE --> PROD[Production apply<br/>CONCURRENTLY-safe]
# atlas.hcl
data "external_schema" "prisma" {
program = ["npx", "prisma", "migrate", "diff", "--from-empty", "--to-schema-datamodel", "prisma/schema.prisma", "--script"]
}
env "local" {
src = data.external_schema.prisma.url
url = "postgres://postgres:postgres@localhost:5432/dev"
dev = "docker://postgres/17/dev"
migration { dir = "file://migrations" }
}
atlas migrate diff add_embedding_index --env local
Output:
-- migrations/20260507142100_add_embedding_index.sql
CREATE INDEX CONCURRENTLY IF NOT EXISTS conversations_embedding_hnsw
ON conversations USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 64);
atlas migrate lint --env local --latest 1
Atlas catches:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
# .github/workflows/migrate.yml
- uses: ariga/atlas-action/migrate/lint@v1
with:
dir: 'file://migrations'
dev-url: 'docker://postgres/17/dev'
- uses: ariga/atlas-action/migrate/apply@v1
with:
url: ${{ secrets.DATABASE_URL }}
dir: 'file://migrations'
Atlas understands RLS, triggers, functions — Prisma doesn't. Add a schema.hcl for those:
policy "tenant_isolation" {
on = table.conversations
as = "PERMISSIVE"
for = "ALL"
using = "tenant_id = current_setting('app.tenant_id', true)::uuid"
with_check = "tenant_id = current_setting('app.tenant_id', true)::uuid"
}
For renames or splits, use the expand/contract pattern:
Each step is a separate Atlas migration.
atlas schema inspect catches it before deploy.CallSphere ships every schema change through Prisma + Atlas across 115+ DB tables. Healthcare (Prisma healthcare_voice) gets a separate atlas env so HIPAA migrations are reviewed independently; OneRoof's RLS policies live in schema.hcl; UrackIT's Supabase migrations sync via the same pipeline. 37 agents · 90+ tools · 6 verticals, never a Friday rollback. Plans: $149/$499/$1,499 — 14-day trial, 22% affiliate.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Q: Atlas or just Prisma migrate? Atlas if you need lint, RLS/triggers, or CI/CD guards. Prisma migrate is fine for personal projects.
Q: Drizzle migrations? Drizzle has its own kit, similar shape to Atlas; ecosystem narrower for advanced lint.
Q: Can Atlas manage extensions?
Yes — CREATE EXTENSION in schema.hcl is supported.
Q: Rollback strategy? Atlas supports down migrations; in practice prefer forward-only with expand/contract.
Q: How fast are large migrations?
CREATE INDEX CONCURRENTLY on 100M rows: 30-90 min. Plan during low-write windows.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
See how Circini's automated incident management pipeline turns alert emails into triaged Jira tickets using Snowflake Cortex AI, GPT-4.1, Airflow & MS Teams.
Your agent's memory, embeddings, and conversation state all live in Postgres. Backups must include vector data and survive a full-region loss. Here's how CallSphere does PITR for 115+ tables.
k3s + hostPath volumes give CallSphere agent hot-reload without redeploys. Vapi customers ship through their pipeline. Engineering velocity matters.
AI agents now participate at every SDLC stage. What changes in requirements, design, review, and deploy when agents are first-class collaborators.
Treating evals as the test suite for agents finally clicks in 2026. The CI/CD pattern with PromptFoo, Braintrust, and GitHub Actions that catches regressions before production.
pgvector 0.9 brings hybrid search, binary vectors, and improved indexing primitives. Why Postgres-native vector is good enough for most teams in 2026 honestly.
© 2026 CallSphere LLC. All rights reserved.
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI