drizzle-kit push:mysql drops unchanged primary key & introspect:mysql fails hard

drizzle-kit version: 0.19.3
database: Planetscale
drizzle.config.ts:
export default {
    schema: './src/lib/db/schema.ts',
    out: './src/lib/db/migrations',
    driver: 'mysql2',
    dbCredentials: {
        connectionString: process.env.DATABASE_URL,
    },
} satisfies Config;


Running drizzle-kit push:mysql errored out because it was trying to drop a primary key

  sql: 'ALTER TABLE `TrainingRegistrations` DROP PRIMARY KEY;',
  sqlState: '42000',
  sqlMessage: 'target: master-data.-.primary: vttablet: rpc 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: wg09dvsn07hoyy0q9wzp): Sql: "alter table TrainingRegistrations drop primary key", BindVars: {REDACTED}'}

As per https://orm.drizzle.team/kit-docs/overview#prototyping-with-db-push i understood that drizzle-kit executes a schema introspection, and then diffs it against my current schema.
So i ran a schema introspection, and the result very wrong
Attached screenshots of the current table structure, obtained by running SHOW CREATE TABLE [name] and the schema that drizzle generated
Screenshot_2023-10-19_at_12.57.45.png
Screenshot_2023-10-19_at_13.02.09.png
Drizzle ORM | %s
Was this page helpful?