Skip to content
Commitwise
Menu

Database migration

Also called: Schema migration

A step that changes an existing database from one schema version to the next without losing its data.

Definition

Installed apps keep their database across updates, so every schema change (a new column, a renamed table) needs a migration from the old version to the new one. Room supports auto-migrations for simple changes and hand-written SQL migrations for the rest; backends use tools like Flyway. Migrations are tested from old versions, because users skip updates.

In practice

Version 3 of a notes app adds a color column; the migration runs ALTER TABLE notes ADD COLUMN color INTEGER NOT NULL DEFAULT 0.

Related terms

Esc

Type to search the whole site.