1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

No users likes right count after migration query

Discussion in 'General PHP and MySQL Discussions' started by giorgino, Feb 14, 2012.

  1. giorgino

    giorgino Well-Known Member

    Hi all :)

    There aren't any migration add on for vBSEO Likes -> xF Likes, so I've made a script for migrate this data form the table vb_vbseo_likes to xf_liked_content with success.
    Now I've the correct data in the xenforo likes table.

    However in the xf_user.like_count field all value are zero.
    After data migration I've run the rebuild users information without luck.
    What procedure I've to follow for updating the users likes information?
  2. digitalpoint

    digitalpoint Well-Known Member

    I don't know enough about the details of the XenForo schema, but assuming that the total number of records in xf_liked_content equals the like_count number in the xf_user table, this query should do it...

    Code:
    UPDATE xf_user SET like_count = (SELECT COUNT(*) FROM xf_liked_content WHERE content_user_id = user_id)
    This comes with the normal warnings... I take no responsibility if it screws something up, do it on a backup first to make sure, etc, etc...
  3. giorgino

    giorgino Well-Known Member

    Thank you for suggestion, but the liked_content table is a progressive table. I've solved with a 100+ lines php script o_O

Share This Page