Skip to content

[BUG]: Receiving a type error when running drizzle-kit generate after renaming a table #4838

Description

@jashiels99

Report hasn't been filed before.

  • 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:

> 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 (<anonymous>)
    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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug/fixed-in-betaThis bug has been fixed in beta (or will be soon).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions