We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1892
    • 82 Posts
    Hi,

    For various reasons I’m delving into a custom modification to webloginpe. In doing so I ran into a "challenge" tweaking the database and the unique keys on modx_web_users_attributes, using Evo 1.03.

    Basically I was trying to do a REPLACE INTO based on the ’internalKey’ but on this database the internalKey doesn’t have to be unique so it added it to the end of the table whereas I wanted to update the record if it already exits.

    So as I understand it on modx_web_users the field ’id’ is a unique key - understandable for each user. This ’id’ value is then used in the modx_web_users_attributes table in the field ’internalKey’. However on the table modx_web_users_attributes this field ’internalKey’ is defined as an index but it is not constrained to be unique. Is there a reason for this which I’m missing? If the ’id’ value has to be unique shouldn’t the ’internalKey’ be unique as well?

    Any comments would be appreciated as I’d like to set ’internalKey’ to be unique on the table but I’m wary of the consequences. It’s either that or I think I need to tweak my code to run an UPDATE rather than REPLACE on the table.

    Regards

    Adrian Cherry