ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Anatomy of the exp_relationships table

August 27, 2010 9:16am

Subscribe [1]
  • #1 / Aug 27, 2010 9:16am

    luvd

    52 posts

    Why does the field rel_data in the table exp_relationships contains all the available channel_fields, member_info etc? Does it mean that, when a new field is added to a channel, that all exp_relationships records will get updated?

    I have imported over 650 entries of a Company-channel, and now I need to set the relationship to a Country-channel right (field Company_country is linked to Country_title). I don’t want to edit every entry manually through the CP to adjust the country-link, so I need to insert the exp_relationships records myself. But due to the complexity of the rel_data field, this doesn’t seem to be an easy task.

  • #2 / Aug 27, 2010 5:41pm

    Robin Sowell

    13255 posts

    Hrm- we might need to shift to CodeShare Corner if we get too into the details of the import bits- but I don’t think relationships will cause a problem for you.

    The reason it stores all of that data is performance- it’s just way more than we’d want to pull dynamically.  That said- you can easily ‘clear relationship cache’- which means, it wipes the rel_data and the reverse_rel_data.  That will be rebuilt dynamically the first time it’s needed on the frontend.  (Related data is cleared by the system in a number of instances- because otherwise it would get out of sync).  You can manually clear it by going to ‘Tools- Data- Clear Caching’.

    That said- if you are planning to code some way of entering the relationships themselves, that can be tricky.  See this wiki post for some help on figuring out the basic structure. 

    But where it comes to the rel_data itself- it’s easy to clean out and will rebuild automatically.  Make sense?

  • #3 / Aug 30, 2010 5:45am

    luvd

    52 posts

    Thank you for your explanation. This will make life (or at least my routine to update the exp_relationships table) much easier.

  • #4 / Aug 30, 2010 12:12pm

    Robin Sowell

    13255 posts

    😉  I’m all in favor of making life easier.  And yep- the wiki rundown of how relationships work is invaluable.  Glad it helps.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases