Hi, I tried you suggestion, as suggested.
I changed my code so that it is the same as yours:
- I used the "TableMappings" instead of the "SchemaMappings"
- I used the same "EngineDataCompareOptions" as you specfied, which includes the "DropConstraintsAndIndexes", and assigned it to the "TableMappings", "ComparisonSession" and "SqlProvider"
- I do not call the method "ReplayUserActions" anymore
- I added the "For...Next" loop to include all TableMappings after the "CreateMappings" call
The unique constraint is NOT dropped!
The script generated is somewhat bigger (because more tables are included), but regarding the concerning table ("tbdRole") the script is exactly the same:
- Code: Select all
-- Drop constraints from [dbo].[tbdRole]
ALTER TABLE [dbo].[tbdRole] DROP CONSTRAINT [FK_tbdRole_tbdTemplate]
-- Drop unused indexes from [dbo].[tbdRole]
DROP INDEX [IX_tbdRole_fldTemplateID] ON [dbo].[tbdRole]
-- Update 2 rows in [dbo].[tbdRole]
UPDATE [dbo].[tbdRole] SET [fldTemplateID]=12 WHERE [fldRoleID]=1001
UPDATE [dbo].[tbdRole] SET [fldTemplateID]=13 WHERE [fldRoleID]=1002
-- Add indexes to [dbo].[tbdRole]
CREATE CLUSTERED INDEX [IX_tbdRole_fldTemplateID] ON [dbo].[tbdRole] ([fldTemplateID]) ON [PRIMARY]
-- Add constraints to [dbo].[tbdRole]
ALTER TABLE [dbo].[tbdRole] WITH NOCHECK ADD CONSTRAINT [FK_tbdRole_tbdTemplate] FOREIGN KEY ([fldTemplateID]) REFERENCES [dbo].[tbdtTemplate] ([fldTemplateID])
ALTER TABLE [dbo].[tbdRole] NOCHECK CONSTRAINT [FK_tbdRole_tbdTemplate]
Could it be that the difference in version of the component "Redgate.SQLDataCompare.Engine" is the reason?
I currently use version 10.0.1.69.
Is it possible that I can obtain your version (build 101), to test this?