-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when running import a second time #3
Comments
I have this same issue. How have you imported a 2nd time besides change the foreign key? |
I've discovered the reason for this issue, and a work around. This happens when a person's family is changed in the legacy system post being imported the first time. What happens is the importer sees the person is already in the DB, so it starts the update. When updating, The code creates a New Rock Context to perform the update. Now, keep in mind, the family technically isn't in Rock yet, because new records are inserted Post update. So, it starts the update, and tries to add the address to a family that hasn't been inserted yet. And, because it's a new Rock Context, it has visibility into new records that need to be added. Now to the good part, the work around. Simply perform an add only import. Once that's completed, using the same slingshot file, perform the update import. It'll take a little longer, because it's "Updating" records it just imported, however, it will now have added the new family, and be able to add the address to the family. This took about 4 hours to figure out today, but it's actually a pretty simple work around. I looked into the code, I'm not sure if there's a simply answer to fix the problem. Perhaps store the IDs of the people that need to be updated, and then updated them after the inserts have taken place. |
When importing people a second time with the option "Update All Records", I occasionally get this error message.
Exception
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.GroupLocation_dbo.Group_GroupId". The conflict occurred in database "RockDevDB_03", table "dbo.Group", column 'Id'.
The statement has been terminated.
The text was updated successfully, but these errors were encountered: