Drizzle migrations

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.

Incomplete schema loads
Ambiguous migration or schema selection
6 of 31
Schema loading study

Apply the fix

  1. 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.

  2. 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.

    npm exec -- drizzle-kit migrate --config=./drizzle.config.ts
  3. 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.