How to create a foreign key referencing to the same table in Strapi?

I’m trying to create a table of category, which will have a column named ParentCategoryId that references the category’s id.

  • Can I create it only in the admin interface or I need to hard code it?
  • In both cases, how can I do it?

Thank you.


You can do this in the admin UI, when you add a field to a content type just select relation and then on the right hand side select the same content type.