Consumer
Overriding Names
Override table/column names to avoid conflicts with your database.
Overview
To override names in FumaDB, you can use the Name Variants API.
For example, if the schema has a messages
table which conflicts with yours, you can override it:
import { fumadb } from "fumadb";
// assuming the library exported
const ChatDB = fumadb();
const client = ChatDB.names({
messages: {
sql: "chat_user",
prisma: "ChatUser",
drizzle: "chatUser",
},
// or to rename columns
"messages.id": {
sql: "message_id",
},
}).client();
// for specific versions
const client = ChatDB.names(["1.0.0"], {
messages: {
prisma: "ChatUser",
},
}).client();
You can also apply a prefix to all tables:
const client = ChatDB.names.prefix("chat_").client();
Be Careful
Make sure to migrate your database if you've updated the name variants.