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.

Clearing Relationship Data using SQL Update

August 18, 2011 11:33pm

Subscribe [3]
  • #1 / Aug 18, 2011 11:33pm

    chrcollins

    77 posts

    I have a situation where I have to change the rel_child_id in an exp_relationships entry (effectively changing the “ownership” of an artwork from one owner to another).  If I set the rel_data to NULL (”“) with the update will that effectively clear the cache or is there anything else I need to do.  It looks like the rel_data is the cached data for the rel_child_id entry.

  • #2 / Aug 19, 2011 12:53pm

    Kevin Smith

    4784 posts

    Hey chrcollins,

    While this isn’t within the scope of the technical support we can ordinarily provide, I do want to find an answer for you. It might be until next week, but let me ask the devs about this and try to get an answer for you. Sound good?

  • #3 / Aug 19, 2011 1:25pm

    Robin Sowell

    13255 posts

    😉  You’ve got the right idea, chrcollins.  Do note- if you’re doing this manually?  Be sure to backup, as relationships are complicated.

    That said- easiest thing is to probably just ‘Clear all Caches’ in ‘Tools- Data- Clear Caching’- that will hit everything.  As part of the everything, it cleans out rel_data and reverse_rel_data as you surmised.  They’ll be dynamically repopulated next time they’re loaded on the frontend.

    If you’re curious, there’s a good Wiki article with more details on how the various tables/fields map out.

    Hope that clarified.

  • #4 / Aug 19, 2011 4:45pm

    chrcollins

    77 posts

    I am changing the relationships field based on user input via an ajax call so doing it manually via the admin panel is not an option. 

      I will definitively backup the database before I try this, Thanks!! 

      My big concern is there is something else out there that has a cached version of this entry and will use it after I have made my changes.

  • #5 / Aug 19, 2011 5:10pm

    Robin Sowell

    13255 posts

    Template or tag caching could cause a delay- though typically those will be very short duration caches.  And under most circumstances, you won’t be using them. 

    That said- you can use the functions class to clear all/any caches- take a look at clear_caching() in functions.  A little nicer than a manual query and if you need to clear some other possible caches, it can handle that.

  • #6 / Aug 19, 2011 5:51pm

    chrcollins

    77 posts

    Great, Thanks!!!  I forgot I could clear caches using the function class!

  • #7 / Aug 22, 2011 4:12pm

    Lisa Wess

    20502 posts

    Glad Robin was able to help you out.  I want to make sure you’re all set before I close this one, so please let us know.  Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases