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
- Regenerates the Prisma client with latest schema
- Force rebuilds all dependent packages (
@cona/core
,@cona/temporal-workflows
, etc.)
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