Back to Glossary

Migration (Database)

A versioned script that changes your database structure, like adding a table or column, in a repeatable way.

A database migration is a file that describes a change to your database schema. Instead of manually running SQL commands on a live database, you write a migration file that can be run, tracked, and rolled back. Each migration has a timestamp or version number so they run in order.

ORMs like Drizzle and Prisma generate migrations automatically when you change your schema definition. The migration file contains the SQL needed to move from the old structure to the new one (and sometimes back). Running migrations is a standard step in every deployment.

For vibe coders, migrations are how you safely evolve your database. AI can generate migration files from natural language descriptions ("add a created_at column to the users table"), but you should always review the generated SQL before running it against a production database.

Related Courses

Links open the course details directly on the Courses page.