drizzle-team / drizzle-team/drizzle-orm
[BUG]: Receiving a type error when running drizzle-kit generate after renaming a table
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
0.44.3
### What version of `drizzle-kit` are you using?
0.31.4
### Other packages
_No response_
### Describe the Bug
I am trying to rename two tables in my database schema. However, I am receiving the following error:
```shell
> db:generate
> drizzle-kit generate
No config path provided, using default 'drizzle.config.ts'
Reading config file '/Users/joeshiels/Sites/autoquote-v2/drizzle.config.ts'
~ tenant_primary_contacts_history › tenant_license_holders_history table will be renamed/moved
~ tenant_primary_contacts › tenant_license_holders table will be renamed/moved
--- all table conflicts resolved ---
TypeError: Cannot read properties of undefined (reading 'columns')
at preparePgAlterColumns (/Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:28040:63)
at /Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:30267:16
at Array.map ()
at applyPgSnapshotsDiff (/Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:30266:51)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async prepareAndMigratePg (/Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:33887:42)
at async Object.handler (/Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:93575:7)
at async run (/Users/joeshiels/Sites/autoquote-v2/node_modules/drizzle-kit/bin.cjs:93059:7)
```
The only things I have changed are the two table names, nothing else. For now, since the app is not live, I dropped and created the tables again. However, this is a bit concerning if I want to rename a table in future with live data.
Any help or insight would be appreciated :)
Contributor guide
Assessment
This issue has not been assessed yet.