Change resource primary key
Is there a way to change a resource's primary key property? For example I have a resource which its PK is
key
istead of id
.
Or all of this should be handled through DataProvider?5 Replies
Hi @nickwoods. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can change a resource's primary key property by using the
meta
property when working with hooks like useMany
. In the meta
property, you can pass the idColumnName
parameter to specify the column name of the primary key if it's different from the default "id". Here's an example:
In this example, the primary key column is changed to "key" instead of the default "id". This will be used when searching for the ids in the data table.
For more information, refer to the Supabase documentation (https://refine.dev/docs/packages/documentation/data-providers/supabase) on using meta
to pass values to the data provider.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------Supabase | refine
Introduction
<@567279564028510208> kapa.ai is still learning and improving, please let us how it did by reacting below
wise-white•16mo ago
Yes, You need to customize your data provider to support that
xenial-black•16mo ago
thx you, I will also try the good bot response
idColumnName
seems to do the job. Nice