#Hello everyone! I have a question

1 messages · Page 1 of 1 (latest)

lapis kernel
#

Hi @spice whale, actually we're suggeting to arrange the schema according to your database not the opposite. But yes it's better to use same names for tables and entities for visibility. Im not sure I understand the second question, could you elaborate more on it? Are you referring data write when user takes action in the UI ?

spice whale
#

Hi, thanks for the clarification!

What I meant to ask is: Should the entities defined in the schema (like organization and group) also have separate tables in the business system's database for tracking purposes?

For example, if I define organization and group in the schema, should I also create corresponding organization and group tables in the database to record relationships between them?

Let's say a user creates a group:1 under org:1. Should the backend process be:

  • Insert a new group record into the database, and then create a relation:
insert into group (fields...) values (...);
writeRelation(org, group);
  • Or is it sufficient to simply execute the relation without additional database records:
writeRelation(org, group);
lapis kernel
#

Thanks for the details. For Permify, it doesn't matter whether you write the same data to your database or not. Permify only evaluates the data in the permission database, which you write using the writeData endpoint (writeRelation will be deprecated, so it's better to not use that).

However, for data consistency and general application logic, it might be better for you to store some data in your own databases as well. So you should go with the first option: 'Insert a new group record into the database, and then create a relation.'

We also have data-sync feature to streamline the data management process without using the writeData API. You can see the details here: https://docs.permify.co/integrations/data-sync