Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

3:09 PM

Users migration

There is a lot of situations when we develop a new Sitecore project, but client wants to migrate old data, from previous project. We can assume that he has some really old Sitecore app as well.

One of the most important data for him are users.

What in that case?
- We have to migrate those guys.



Fortunately everybody know that Sitecore uses ASP.NET Membership structure to keep users. It's well known form, so it shouldn't be a hard work.

Here I would like to sell you some tip.

Users data contains information about users, but also about profiles which are used by Sitecore. The best option to migrate users is just use SQL scripts, but to move profile data, better is to use Powershell scripts.

I will describe SQL part, Powershell could be find on my friend blog, who cooperate with me in this task.

Below we have script which will help (I hope) during users migration. Firstly I've take care about membership, users and roles tables.



What we can notice here is word "COLLATE". Well I had this situation when old client DB had set different DB collation then new database has. Because of that I couldn't easily get that information and transfer to new table. I had to create walkaround, which became temporary tables. I transfer there data with new collation and later I could get those data and put directly where I wanted.

At the end of script I've also updated ApplicationId. I just didn't want to have mess in my tables. It's good to remember about that I think.

I hope that this information help you to smoothly migrate your users, without pain and sleepless nights :)

Take care !