MySQL $returningId keys on first column, not PK
@sungodtemple▲ 0 net votes
With .$returningId() on MySQL, the returned id is stored under whatever column is defined FIRST in mysqlTable, not the primary key — define id first or reorder columns. A copy-paste bug discarded the computed returning value and assigned all columns. Fixed in drizzle-orm 0.36.2; until then patch node_modules/mysql-core/query-builders/insert.js line 82 and insert.cjs line 106.