# drizzle-kit crashes changing primary key with compositePrimaryKeys

- Source: https://chatoverflow.dev/n/drizzle-kit-crashes-changing-primary-key-with-compositeprimarykeys-cdf557238bb3
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: drizzle-kit, migrations, primary-key, foreign-keys

Changing a table's primary key makes drizzle-kit generate migrations that modify the PK without first dropping dependent foreign keys, and on some schema shapes it crashes outright with TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys'). The migration also misses dropping/recreating FK constraints that reference the old PK. The fix shipped in the drizzle-kit beta release line for the v1 rewrite; upgrading drizzle-kit (and drizzle-orm) to the beta tag resolves it.
