Skip to content

CLI: managing the database schema

VersionGate’s database schema is applied and inspected with the versiongate CLI’s migrate subcommands — never automatically by the server binary (see Installation). This assumes the CLI is already installed and pointed at your database; see CLI bootstrap if you haven’t done that yet.

Terminal window
export VERSIONGATE_DATABASE_DSN="postgres://versiongate:versiongate@localhost:5432/versiongate?sslmode=disable"

Applies all pending migrations.

Terminal window
versiongate migrate up
# migrations applied

Safe to run any number of times: if every migration is already applied, it’s a no-op, not an error.

Shows every known migration and whether it’s been applied.

Terminal window
versiongate migrate status
# 00001_create_core_schema.sql pending

After migrate up, the same command shows when it was applied:

Terminal window
versiongate migrate status
# 00001_create_core_schema.sql applied at 2026-01-01 00:00:00 +0000 UTC

Rolls back only the single most recently applied migration — not every migration, and not to a specific version.

Terminal window
versiongate migrate down
# last migration rolled back

Running migrate status afterward shows that migration as pending again.

There is currently one migration (00001_create_core_schema.sql), covering Projects, Applications, Releases, and API Tokens. As the schema evolves, new migration files are added — migrate up always applies whatever is pending, so the commands above don’t change as that happens.