FumaDB
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";

// library exposed
const ChatDB = fumadb();

// your code
const client = ChatDB.names({
  messages: {
    sql: "chat_user",
    // you can set for ORMs too, like
    prisma: "ChatUser",
    drizzle: "chatUser",
  },
  // or to rename columns
  "messages.id": {
    sql: "message_id",
  },
}).client();

You can also conveniently apply a table name prefix:

const client = ChatDB.prefix("chat_").client();

Be Careful

Do not change the name variants once you have initialized the schema on your database.

You will need to migrate your database again if you've updated the name variants.

On this page