drizzle-team / drizzle-team/drizzle-orm
[BUG]: getTableConfig primaryKeys doesn't return all primary key columns
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.28.6`
### What version of `drizzle-kit` are you using?
_No response_
### Describe the Bug
When using `getTableConfig()`, the `primaryKey` attribute doesn't return any columns where the primary key was referenced in the column vs in the table.
```ts
const table = pgTable({
id: varchar("id").primaryKey()
})
const {primaryKey} = getTableConfig(table); // primaryKey is an empty array
const table2 = pgTable({
id: varchar("id")
}, (table) => {
pk: primaryKey(table.id)
})
const {primaryKey} = getTableConfig(table2); // primaryKey has 1 item
```
### Expected behavior
I expect the `primaryKey` array to have all primary key columns.
### Environment & setup
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.