refactor(drizzle): use getTableName utility (#13257)
~~Sometimes, drizzle is adding the same join to the joins array twice (`addJoinTable`), despite the table being the same. This is due to a bug in `getNameFromDrizzleTable` where it would sometimes return a UUID instead of the table name.~~ ~~This PR changes it to read from the drizzle:BaseName symbol instead, which is correctly returning the table name in my testing. It falls back to `getTableName`, which uses drizzle:Name.~~ This for some reason fails the tests. Instead, this PR just uses the getTableName utility now instead of searching for the symbol manually.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import type { Table } from 'drizzle-orm'
|
||||
|
||||
export const getNameFromDrizzleTable = (table: Table): string => {
|
||||
const symbol = Object.getOwnPropertySymbols(table).find((symb) =>
|
||||
symb.description.includes('Name'),
|
||||
)
|
||||
import { getTableName } from 'drizzle-orm'
|
||||
|
||||
return table[symbol]
|
||||
export const getNameFromDrizzleTable = (table: Table): string => {
|
||||
return getTableName(table)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user