Perhaps this diagram will help you understand the relationship between users, contacts, portals and portal_roles.
Since you are interested in coding, I would just use the Admin GUI to create the entities and then implement a hook to execute SQL queries as needed.
Full disclaimer, the developers strongly discourage the use of raw SQL and would like you to learn and use their custom ORM query language only, but quite frankly, if you are fairly proficient with SQL and knowledgeable about basic avoidance of malicious SQL injection, it is in my opinion, an uphill and unecessary battle.
in our application we use the free app Flyspeed SQL Query (from which the screenshot was taken) to test queries which saves us many hours of debugging.
Leave a comment: