KingdomFirst / Bulldozer

A multi-component Windows app to convert data into Rock RMS from other church management systems.
https://www.rockrms.com/
Apache License 2.0
8 stars 9 forks source link

import into an existing Rock database #9

Closed tedinedh closed 5 years ago

tedinedh commented 5 years ago

Import into existing Rock database throws exception

5/14/2019 12:24:39 PM,Transform Data,"System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at Bulldozer.F1.F1Component.LoadGlobalObjects(DataScanner scanner) at Bulldozer.F1.F1Component.TransformData(Dictionary2 settings) at Bulldozer.ProgressPage.bwImportData_DoWork(Object sender, DoWorkEventArgs e)"

treyhendon commented 5 years ago

Hey @tedinedh sorry you're having a problem with this!

I assume you're running a new F1 MDF into a database that ran another migration sometime previously. For example: You have a church merger and are importing a F1 MDF from second church into the first church's Rock instance that used Slingshot to migrate from CCB.

Is something like this your scenario?

tedinedh commented 5 years ago

Exactly! Is there some work around for this?

tedinedh commented 5 years ago

I used excavator before, we are merging another F1 database into and existing Rock F1 import.

treyhendon commented 5 years ago

Looking at the code, the only quick (and not super pretty) suggestion would be to null out the Foreign Id, Key, and Guid columns from all the tables in the database. I would test that in a sandbox first, but it's probably your only way to safely run in another F1 database.