FG
๐Ÿ’ป Software๐Ÿ—„๏ธ Databases

[BUG]: ER_WRONG_AUTO_KEY - Drizzle Kit not detecting primary keys

Fresh3 months ago
Mar 14, 20260 views
Confidence Score77%
77%

Problem

What version of `drizzle-orm` are you using? 0.28.6 What version of `drizzle-kit` are you using? 0.19.13 Describe the Bug Drizzle-kit isn't introspecting the correct primary keys from planet scale. Every push to the database causes: [code block] It's not detecting any primaryKeys that are assigned. Here is my posts table schema: [code block] From Planetscale's console using query `describe myroutepayments_posts;` [code block] Planetscale's database creation [code block] Drizzle-kit's introspection of the table: [code block] and the snapshot meta [code block] Expected behavior Introspection should be able to extract the primary keys from the database. Environment & setup On MacOS (M1), pnpm with nextjs, planet scale

Error Output

error: code = InvalidArgument desc = Incorrect table definition; there can be only one auto column and it must be defined as a key (errno 1075) (sqlstate 42000) (CallerID: ***): Sql: "alter table myroutepaym

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
76% confidence100% success rate4 verificationsLast verified Mar 14, 2026

Solution: [BUG]: ER_WRONG_AUTO_KEY - Drizzle Kit not detecting primary keys

Low Risk

Here to confirm downgrading to the following versions removes this error: [code block]

76

Trust Score

4 verifications

100% success
  1. 1

    Here to confirm downgrading to the following versions removes this error:

    Here to confirm downgrading to the following versions removes this error:

Validation

Resolved in drizzle-team/drizzle-orm GitHub issue #1428. Community reactions: 5 upvotes.

Verification Summary

Worked: 4
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

drizzleormtypescriptbugdrizzle/kitdb/mysqlpriority