Reference

Database Migrations

Understand how drizzle database migrations work in NuxtStart nuxt starter kit

Why NuxtStart Doesn't Include Migrations

NuxtStart does not include a migrations folder. This is an intentional design decision to prevent migration conflicts and ensure flexibility for your application.

The Problem with Pre-Generated Migrations

When using a parent-child repository structure (NuxtStart → your app), pre-generated migrations create serious issues:

  1. Timestamp Conflicts: If the NuxtStart adds a migration with an older timestamp than your app's last applied migration, Drizzle will error and refuse to apply it.
  2. Merge Complexity: You might not update the NuxtStart for months or years. When you finally pull updates, resolving migration conflicts requires manually regenerating all your migrations from the conflict point forward.
  3. Lost Flexibility: Pre-generated migrations force a specific migration timeline that doesn't account for when YOU actually need the changes.

Our Approach: Schema-First

Instead, we maintain schema files only (src/db/schema/):

NuxtNuxtStart provides:

  • ✅ Schema definitions (tables, relations, indexes)
  • ✅ Database structure as TypeScript
  • ❌ No drizzle/ migrations folder

You maintain:

  • ✅ Your own migrations folder
  • ✅ Generated when YOU need them
  • ✅ With timestamps that match YOUR development timeline

Your Workflow

Initial Setup

# Install dependencies
pnpm install

# Generate your first migration from our schema
pnpm db:generate

# Apply migrations to your database
pnpm db:migrate

After Pulling NuxtStart Updates

# Pull latest NuxtStart changes
git pull nuxtstart main

# Resolve any schema merge conflicts in Git (normal TS files)

# Generate a NEW migration capturing the changes
pnpm db:generate

# Review the generated SQL, then apply
pnpm db:migrate

Benefits

No timestamp conflicts - your migrations always have current timestamps
No manual regeneration - just generate from current schema state
Git-friendly - schema conflicts are normal TS merge conflicts
Update flexibility - pull NuxtStart updates on YOUR schedule
Full control - you own your migration timeline

Important Notes

  • Commit your migrations - they're your application's database history
  • Review generated SQL - always check migrations before applying to production
  • Schema is source of truth - Drizzle compares your schema files against the last snapshot to generate diffs
  • NuxtStart updates - when pulling schema changes, a new migration will be generated with your app's specific changes

Migration Commands

# Generate migration from schema changes
pnpm db:generate

# Apply pending migrations
pnpm db:migrate

# Open Drizzle Studio to inspect database
pnpm db:studio

# Push schema directly to dev DB (skip migrations)
pnpm db:push

TL;DR: We give you the schema, you generate the migrations. This prevents conflicts and gives you full control over your database timeline.

Copyright © 2026