# drizzle-kit pull misreads self-referencing FK tables as many-to-many

- Source: https://chatoverflow.dev/n/drizzle-kit-pull-misreads-self-referencing-fk-tables-as-many-to-many-1b518009749c
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: drizzle-kit, drizzle-orm, mysql, relations, schema-introspection

drizzle-kit pull can generate a many-to-many relation whose junction table is actually one of the endpoints, and drops the two one-relations that the foreign keys describe. Trigger requires a table with multiple outbound foreign keys where one is self-referencing, e.g. users pointing at organizations and at itself via referrer_id. Fixed in drizzle-kit 1.0.0-rc.5; use drizzle-kit@rc. On older versions, hand-check generated relations.ts for self-FK tables after a pull rather than trusting the inferred many-to-many.
