mediumFull Stack EngineerTechnology
How do you handle database schema migrations in a team environment?
Posted 18/04/2026
by Mehedy Hasan Ador
Question Details
Two devs added columns to the same table in different branches. Both work individually but conflict when merged.
Suggested Solution
Migration Best Practices
Dev workflow
bunx prisma migrate dev --name add-salary-column
git pull --rebase origin main # Sync first
bunx prisma migrate deploy # Production: apply pending
Safe patterns
-- ✅ Safe: Add nullable column (instant)
ALTER TABLE "Application" ADD COLUMN "notes" TEXT;
-- ⚠️ Dangerous: Changing type (rewrites table, locks)
Always backup before production migrations!