What is Migration?

A script that changes the shape of your database, such as adding or removing a column. Some changes delete data forever.

Where Migration goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • Data you can lose · 4 minutes · Pro

    Back to yesterday's version

    Today's update broke checkout, so you restore yesterday's version in your builder. Now the whole app crashes.

    Why does rolling back my app break it?

    Rolling back restores your code, not your database. If today's migration renamed or dropped a column, yesterday's code still expects the old shape and crashes. Make schema changes additive: add the new column, switch the code, and remove the old one only when nothing uses it.

    Read the fix
  • Data you can lose · 5 minutes · Free

    The agent that reset production

    You asked your coding agent to fix a failing migration. It says it 'reset the database to resolve drift'. Your live customers are gone.

    How do I stop an AI agent deleting my database?

    Do not keep production database credentials where the agent runs. Use a separate development database locally, give production a role that cannot drop tables, and keep backups the agent cannot reach. Instructions like 'never touch production' are not enough; only permissions reliably stop a destructive command.

    Walk it, free
Database
Where your app keeps its data, organised in tables, like a set of spreadsheets.
Table, row, column
A table is like one spreadsheet (orders). Each row is one item (one order); each column is one detail (price, date).
Secret key
A password your app uses to talk to a paid service. Anyone who sees it can use it, and spend your money.
Environment variable
A setting stored outside your code, like a secret key. Your laptop and your live site each have their own copy.
Production
The real, live version of your app that customers use, as opposed to the copy on your laptop.
Authorization
Checking what someone is allowed to do once you know who they are. Signed in does not mean allowed.

All 62 terms in the glossary