Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Richard Rees 27 posts 57 karma points
    May 28, 2019 @ 17:46
    Richard Rees
    0

    Updating "schema" for old records

    Is there a recognised way of dealing with schema changes for doctypes, membertypes, mediatypes when you add new properties but have old records?

    Here is what I'm facing at the moment...

    I have a member type (StandardMember) with over 800 members on the live system. Yesterday I added 2 new properties.

    I have a change password page which sets the password and then does a memberservice.Save()

    For new standardmembers created since yesterday, all is good. If any standardmembers created BEFORE yesterday try to change their password they get the following error

    Cannot insert duplicate key row in object 'dbo.cmsPropertyData' with unique index 'IXcmsPropertyData1

    This only happens the first time and after that error, saves on that member happen with no issues. If I go into backoffice and select the member and save, the problem disappears. I am guessing the error is happening because the old users haven't yet been updated to the new standardmember schema, and it takes a save to do that.

    I had a similar issue with a doctype the other day, and had to resolve it by going into every piece of content with that doctype and republishing. But I can't do that with the standardmembers- there are over 800 of them.

    I was thinking of creating a run once page that looped through all standardmembers and did a memberservice,save(), but surely there must be a better way?

    Thanks

  • Gary Taylor 3 posts 73 karma points
    Feb 12, 2021 @ 10:14
    Gary Taylor
    0

    Hi,

    did you ever find a way to fix this ?

Please Sign in or register to post replies

Write your reply to:

Draft