DT
Drizzle Team10mo ago
JT

How to get the name of the table

In 0.22 I used to import Name from drizzle-orm/table.js and then I could get the name of the table by calling table[Name]. I'm now upgrading to the latest, and a lot of things have changed. Obviously this is one of them, and I can no longer get the name of the table that way. What is the appropriate way to inspect the object and get the name of the table?
1 Reply
JT
JTOP10mo ago
Actually, I think I figured it out. For those that may be looking:
import { getTableName } from "drizzle-orm";
\\...
const tableName = getTableName(UserTable);
import { getTableName } from "drizzle-orm";
\\...
const tableName = getTableName(UserTable);
Want results from more Discord servers?
Add your server