Welcome back

Sign in to your Fakebase account.

or

Don't have an account? Create one

Studio / Migrations

Migrations

Keep schema changes as SQL files in your repo, in sync with the database you have open.

View as markdown

Migrations are how Fakebase remembers schema work. Each change becomes a SQL file in your project.

Set up migrations

Migrations belong to a project: a folder with fakebase.toml and a migrations folder. If the database you have selected is a connection without a project, Migrations shows Browse-only connection. Choose Create project to make one for this database, or Open project folder to use one you already have. See Databases.

If the database already has tables, choose how to start:

  • Baseline takes a snapshot of the current schema without writing a file. Your next change becomes the first migration.
  • Initial migration writes the current schema as the first migration file and records it as applied.
  • Import SQL files appears when the folder has .sql files that aren't named as migrations yet. Studio renames them to timestamped migration names, and they stay pending until you apply them.

A project with no migrations shows No migrations yet. Make your first one in your editor, or change the schema in Tables or the SQL Editor and save it as a migration.

The journal

The Migrations page is the journal: what has been applied, what is still pending, and whether the live database still matches the files.

Reviewing migrations in Fakebase Studio

Statuses

  • Applied — this file has been recorded on the database.
  • Pending to be applied — the SQL is on disk and still needs to run.
  • Waiting for file save — the database already changed (for example from the studio). Save it as a migration, or discard it. See Schema drift.
  • Modified — an applied file was edited on disk. Restore it before you apply, bundle, or revert.

An amber dot on Migrations in the sidebar means the live schema and the snapshot have drifted.

Review a file

Select a migration to open it. SQL Migration shows the file. Schema Overview shows what was added, removed, changed, or left alone.

From here you apply pending files, capture drift, or manage history — restore, bundle, delete, or relink the folder.


Next steps