Guides
Update schema
Database Schema Updates - Turbo Cache Management
This guide explains how to properly handle database schema changes in the CONA monorepo to ensure Turbo doesn’t use stale cached builds.
🔧 Auto-Invalidation Setup
The project is now configured to automatically detect schema changes and invalidate Turbo cache when needed.
What Gets Tracked
✅ Schema file changes: packages/database/prisma/schema.prisma
✅ Migration changes: packages/database/prisma/migrations/**
✅ Generated Prisma client: .prisma/**
and node_modules/.prisma/**
✅ Database package builds: Any change triggers dependent package rebuilds
🚀 Quick Commands
When You Update the Schema
This command:
- Regenerates the Prisma client with latest schema
- Force rebuilds all dependent packages (
@cona/core
,@cona/temporal-workflows
, etc.)
For migrations, run separately:
Alternative Commands
🎯 Automatic Cache Invalidation
With this configuration, Turbo will automatically:
- Detect schema changes when you modify
prisma/schema.prisma
- Invalidate build cache for all packages that depend on
@cona/database
- Rebuild dependent packages like
@cona/core
,@cona/temporal-workflows
,@cona/webapp
🧪 Testing Schema Changes
Before Schema Changes
After Schema Changes
⚠️ Important Notes
Environment Consistency
- Ensure your
.env.local
files point to the correct database - Local development should use
localhost:54322
(Docker) - Production uses remote Supabase connection
When Turbo Cache Issues Persist
Temporal Workers
After schema changes, always restart temporal workers: