This project has moved. For the latest updates, please go here.
2

Closed

Diff api - Unique names for foreign keys error

description

If two tables have foreign keys with the same name an index is appended in
IRepository.GetAllForeignKeys()

This results to an error in SqlCeDiff.CreateDiffScript(...):
List<Constraint> targetFKs = targetRepository.GetAllForeignKeys().Where(fk => fk.ConstraintTableName == tableName).ToList();
targetFKs has wrong foreign key names resulting in a script like
ALTER TABLE [MyTable] DROP CONSTRAINT [FK_bla_grmpf1];

instead of
ALTER TABLE [MyTable] DROP CONSTRAINT [FK_bla_grmpf];


This problem did not occur in a previous version e.g. 3.5.1.14 (Build 85301)

Temporarly it helped to restore the old algorithm using GetAllForeignKeys(string tableName):
List<Constraint> sourceFKs = sourceRepository.GetAllForeignKeys(tableName);
List<Constraint> targetFKs = targetRepository.GetAllForeignKeys(tableName);
Currently I don't see the necessity to fetch all foreign keys table name independant (and so possibly made
unique) as they are still filtered afterwards with Linq.

But never mind. No offense. The project is still great.
Closed Dec 5, 2015 at 12:07 PM by ErikEJ
Move dto github

comments