# Find missing Drizzle tables by checking the monorepo migration path

Use the Drizzle config and migration directory wired to the package that owns the table. Follow that package's deploy command to find the config, check its `out` directory, and apply that migration history to an empty test database before changing the schema.

## From the research

6 of 31 incomplete schema loads were attributed to ambiguous migration or schema selection.

- [Schema loading study](https://github.com/ohad6k/viberaven-research/blob/2d45c586d8d73b8913651894f4451b8071086daf/studies/neutral-loading-expanded/README.md)

## Apply the fix

### Find the config the app actually uses

Start with the migration script in the relevant `package.json` or deployment workflow. Record the working directory, `--config` path, migration `out` directory and database target. The `schema` setting points to the TypeScript input used for generation.

### Run the existing migration history

From the owning package directory, run its pinned migration command with the chosen config against an empty disposable database. This example assumes the project uses npm and the selected config points to that disposable database.

```bash
npm exec -- drizzle-kit migrate --config=./drizzle.config.ts
```

### Check where the table is created

Look for the migration that creates the expected relation. Check the schema name it declares and any earlier migration it depends on. If the history has no creation for that table, generate and review the missing migration from the owning package's schema.

## Verify the change

Rebuild the test database from empty. Check that the table exists under the schema the app queries and that the app's ordinary startup query can read it.

## Research and sources

In a benchmark of 200 pinned PostgreSQL repositories, 169 schema loads completed and 31 were incomplete. We attributed 6 incomplete loads to ambiguous migration or schema selection, another 6 to a missing table or relation, and 8 to unsupported or unresolved Drizzle schema projection. The benchmark measures loader behavior on the selected source revisions in an isolated database.

- [Expanded schema loading outcomes](https://github.com/ohad6k/viberaven-research/blob/2d45c586d8d73b8913651894f4451b8071086daf/data/orm-loads-expanded.csv)
- [Drizzle Kit configuration file](https://orm.drizzle.team/docs/drizzle-config-file)
- [Drizzle Kit migrate](https://orm.drizzle.team/docs/drizzle-kit-migrate)

Source: https://viberaven.dev/answers/drizzle-migrations-missing-table-monorepo

Site index: https://viberaven.dev/llms.txt
