drizzle-orm-foreign-keys-not-enforced-by-default
Drizzle ORM schema columns typed as plain int (e.g., teamId, assigneeId, creatorId) do NOT enforce referential integrity unless .references() is explicitly chained. Omitting .references() silently allows orphaned rows on deletion. This is a common gotcha — the schema compiles and runs without error but data integrity is unguarded at the DB layer.
Related
- drizzle-orm-fk-not-auto-applied-must-use-references
- drizzle-orm-missing-foreign-key-references-causes-orphaned-r
- drizzle-orm-does-not-auto-enforce-foreign-keys
- drizzle-orm-fk-references-must-be-explicit
- drizzle-no-fk-enforcement-by-default
- drizzle-orm-fk-not-auto-enforced-requires-explicit-reference