# komrad migrate

Apply any pending database migrations

[komrad](https://komrad.dev/latest/cli.md)

```bash
komrad migrate
```

Apply any pending database migrations, connecting as the login that owns the schema.

The server never migrates: an engine connects as a login that cannot change the schema, and it refuses to start against a database missing migrations its build carries. So every upgrade runs this first, with owner\_database\_url (or KOMRAD\_OWNER\_DATABASE\_URL) naming the owner, which falls back to database\_url on a database no engine has joined.

While owner\_database\_url names the embedded Postgres, this creates it when there is none and starts it when it is down.

It refuses while another komrad is connected and the build holds migrations the database has not seen, since a change it makes could break them. It is safe to run against a database that is already current; it says so and exits zero.

## Inherited flags

| Flag | Type | Description |
| --- | --- | --- |
| [`--config`](https://komrad.dev/latest/cli/migrate.md#inherited-config) | stringArray | path to a config TOML, repeatable, later files win over earlier ones |
| [`--engine`](https://komrad.dev/latest/cli/migrate.md#inherited-engine) | string | engine to reach: local for this machine, or a file in the config's engines directory, layered over the config |
