drizzle-team / drizzle-team/drizzle-orm

[BUG]:not able to change the data type of the FK column.

Open
#3,630 0 comments 0 reactions 0 assignees View on GitHub
bug db/postgres priority
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.36.0

### What version of `drizzle-kit` are you using?

^0.27.1

### Other packages

_No response_

### Describe the Bug

as I want to change the data type of any foreign key column so I guess query should be
`ALTER TABLE "pinata" ALTER COLUMN "user_id" SET DATA TYPE text USING "user_id"::text;`
but it's not adding the _USING_ clause in that and I am not able to change the type of FK column
it's just giving this query `ALTER TABLE "pinata" ALTER COLUMN "user_id" SET DATA TYPE text`

my schemas
```tsx
export const userTable = pgTable("user", {
id: serial("id").primaryKey(),
});

export const pinataTable = pgTable("pinata", {
id: text("id").primaryKey(),
userId: text("user_id")
.notNull()
.references(() => userTable.id),

});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.