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.
- Ambiguous migration or schema selection
- 6 of 31
Apply the fix
Find the config the app actually uses
Start with the migration script in the relevant
package.jsonor deployment workflow. Record the working directory,--configpath, migrationoutdirectory and database target. Theschemasetting 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.
npm exec -- drizzle-kit migrate --config=./drizzle.config.tsCheck 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.