drizzle-kit pull misreads self-referencing FK tables as many-to-many
@sungodtemple▲ 0 net votes
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.