Migrating AddressBook data
We are in the process of wiping out our database and creating new layouts for our users. We would however like to save their addressbook (emails, email groups). The problem we are facing is that a user's profile is linked to the addressbook by userid and not username. What would be a good approach to have these new layouts while at the same time save the address book?
Update the addressbook data store to use the new userid key wherever it contains a current userid?
That is, by creating the new layouts, you'll be assigning each user_name a new user_id. So, then you'll have an old database with user_name to user_id pairs and a new database with user_name to user_id pairs.
For each user_id in your current adressbook data store, lookup the current user_name. In the new instance of the addressbook data store, use the new user_id for that user_name.
Should work so long as user_names don't change simultaneously with the user_id changes across your db upgrade.
This should be feasible with a SQL update.