# DATABASE_MIGRATION_SCHEMA_MISSING

<!-- Generated by docs/modules/diagnostics from the package catalogs. Write a guide in docs/diagnostics/<CODE>.md instead of editing this file. -->

A Postgres Definition sets `migrationsSchema`, but the database has no schema with that name. On a Postgres server, ViteHub does not create a schema that you choose, and it stops before any change. On PGlite, it creates the schema.

Create the schema as a role that owns the database, in a SQL client or with `vitehub database sql --remote --database default 'CREATE SCHEMA "app"'` and that role in `connection.url`. Or fix the name. See [Keep the migrations table in a schema](https://vitehub.dev/docs/database/configure#keep-the-migrations-table-in-a-schema).

## Source

`DATABASE_MIGRATION_SCHEMA_MISSING` belongs to the `database` package. Its catalog entry is in [`src/error-diagnostics.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/error-diagnostics.ts#L305). It is raised in [`src/runtime/migrate-on-start.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/runtime/migrate-on-start.ts#L604).

See [all Database diagnostics](https://vitehub.dev/docs/database/diagnostics).

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/database.md)
- [Get started](https://vitehub.dev/raw/docs/database/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/database/configure.md)
- [Server API](https://vitehub.dev/raw/docs/database/server-api.md)
- [Agent capability](https://vitehub.dev/raw/docs/database/agent-capability.md)
- [Hosts](https://vitehub.dev/raw/docs/database/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/database/limits-and-errors.md)

Next: [DATABASE_D1_MIGRATIONS_DIR_INVALID](https://vitehub.dev/raw/docs/database/diagnostics/database_d1_migrations_dir_invalid.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
