Database ID's

Miguel Vieira asked on July 2, 2015 18:19

We did a import of our site to a new kentico instance with a clean Database(8.2.26 version) but we found after that the primary Key ID's Changed.

Is there a way that importing to a clean DB we keep the same ID's?

Example:

The nodeID of TeamMember1 was 20, and that is what is saved in the Database of the BlogPostAuthor, but now the TeamMember1 NodeID is 10, and no Blog Post Author is shown.

Recent Answers


Brenden Kehren answered on July 2, 2015 18:33

Were your users also imported? You might want to check your export package and ensure all the users were exported. It should have updated those during the import.

The only way to keep the original primary keys would be through a sql script or tool from my experience. I don't believe Kentico will handle keeping the PK's the same.

0 votesVote for this answer Mark as a Correct answer

Olivier Cozette answered on July 2, 2015 18:37

I had a similar problem months ago. Since then, we have changed all IDs for the correspondent GUIDs (and the logic behind too), otherwise, you're on your own, Kentico is not tracking ID's on different instances.

0 votesVote for this answer Mark as a Correct answer

Miguel Vieira answered on July 2, 2015 18:51

Brenden Kehren everything was exported, the info is there, just with different IDs. If i created a page that had NodeID 10 and then deleted it, the next page will have NodeID 11 and i won't have a NodeID 10.

But when i import i will get NodeID 1,2,3...8,9,10.

Juan Alchourron but changing to GUIDs u can't use page selector, right? If i change it to GUID's I have to use Uni Selector?

0 votesVote for this answer Mark as a Correct answer

Olivier Cozette answered on July 2, 2015 19:29

You'll probably have to change your logic, yes. But as you said on your last message, every time you add an object and then you delete this object, your ID's will become not synchro anymore between your instances. At least, GUIDS are allways the same. I don'y know where you are on your project, but we had to change from scratch our logic to be able to keep synchro between instances, knowing we have to move sites from one server to another, from dev to prod and to dev again, and so on. Having only one live version, you can keep ID's, no problem at all. Having staging and prod, or having to move sites or servers while 'hardcoding' some parameters using ID's = very complicated to keep up to date on both instances.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.