# DATABASE_MIGRATION_CONVERSION_FAILED

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

`vitehub database up` reports why it cannot convert the old layout. If it fails while it checks the journal, loads the Database Definitions, or replays the SQL, it leaves the migration files as they were.

Fix the problem and run `vitehub database up` again. To restore a missing migration or journal entry, use version control. Do not change a recorded timestamp to make room for another file: an existing Drizzle ledger can use that second to identify an applied migration.

If automatic conversion cannot preserve the migration order and ledger matches, convert the history manually. Run `vitehub database migrate --dry-run` on a copy of an existing database and check that it lists the right migrations as applied before you deploy.

## Source

`DATABASE_MIGRATION_CONVERSION_FAILED` 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#L200). It is raised in [`src/cli.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/cli.ts#L892), [`src/cli.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/cli.ts#L894), [`src/cli.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/cli.ts#L897), [`src/cli.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/cli.ts#L903), [`src/cli.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/database/src/cli.ts#L924), and 7 more places.

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_MIGRATION_DATA_LOSS](https://vitehub.dev/raw/docs/database/diagnostics/database_migration_data_loss.md)

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