spotty-amberS
Refine3y ago
4 replies
spotty-amber

Change id column name for useOne to anything other than "id"

This seems like such an easy question to answer, but after hours of searching through the docs and already asked questions on Discord I give up and post this here.

I'm using useOne to get data from a resource like this
const { data: rawData, isLoading: isLoading, isError: isError } = useOne({
    resource: "users",
    id: user_id,
});


My issue is that the column containing the user id in table "users" is not called "id" in the database but "user_id". How can I make sure useOne uses "users.user_id" as column to check for the id and not "users.id". Right now I'm receiving the error

"message": "column users.id does not exist"


because of course the column users.id doesn't exist
Was this page helpful?