# Creating and Changing Tables: Migrations

Migrations are numbered SQL scripts that create and change an API's tables, run in order when the app starts, with SQLite's PRAGMA user_version remembering how many a database has had, so every copy of the database gets each change exactly once.

![Cheat sheet: Creating and Changing Tables: Migrations](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/8da18bfd7aa14457864cd65cf468a359.webp)

- Category: FastAPI
- Level: Journeyman
- Tags: Database Migration, fastapi, Lifespan Events, PRAGMA, rest-api, Schema (database)
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/fastapi-data-schema-and-migrations-cheat-sheet
