TypeError: Cannot read properties of undefined (reading 'type') on drizzle kit push command
Can't run drizzle push:mysql on planetscale database, I'm getting this weird error:
The error is caused by this part:
currentSchema.tables[statement.tableName].columns[unsquashed.columns[0]].type
3 Replies
did you resolve this?
geting this error too..
I get this error using planetscale DB and changing the primary key.
Fixed by incrementally pushing:
1. add the ID field back to the table, push, should be successful
2. change the type of the ID field to varchar / something other than serial or primaryKey. Add the new primary key field, in my case its a compound key. Push
3. Delete the ID field and push again
seems to be a bug with changing the primary key. Some kind of name conflict
TLDR
This bug happens when you change your primary key.
To fix you need to re add the name of the field you deleted to your table, but not as serial or primary key. Once you push your changes you can delete the old field and push again.
Had the same issue, but with an index. Same error and same workaround though. Had to change the index to a regular index from a unique one and then I could delete it with a separate push.