Yesterday, I struggled a lot while importing model store which has thrown below error and stopped abruptly.
“The delete statement conflicted with the reference constraint “FK_ManifestHistoryHasCategoryId”. The conflict occured in databaes “db_name_model”, table “dbo.ModelOperationHistory”, column ‘categoryId’.
The statement has been terminated..Microsoft.Dynamics.AX.Framework.Toolds.ModelManagement.PowerShell.ImportStoreCommand”
when I started my R&D, I found different resolutions but best and less time consuming which I found is I am going to share now. I tried this and works magically.
Here you go and just follow these steps.
1. Create a temporary schema in the model store database.
2. Import the model store file into the temporary schema.
3. Apply the temporary schema.
Please have a glance on scripts which I executed in Management shell.
a) Create a temporary schema in the model store database and importing the file into it.
This example imports a model store to the Microsoft Dynamics AX database and associates it with a non-default schema (TemporarySchema). The new model store is not visible to Microsoft Dynamics AX until the imported model store has been applied to the default schema (dbo) by running Import-AXModelStore with the -Apply parameter. If you have AX instances more than 1, you need to supply -config parameter in script otherwise not needed. If you have conflicts then go with -IDConflict parameter either with overwrite or push, -Verbose parameter will show you objects conflicting in importing environment.
Import-AXModelStore -File “Path\filename.axmodelstore” -config: configname -schemaname TemporarySchema -Verbose -IDConflict Overwrite
b) Apply the temporary schema.
Import-AXModelStore -apply:TemporarySchema -config: configname.
Hope this helps you.
Till then Happy Daxing..