web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

axutil importstore can't delete ModelOperationHistory

(0) ShareShare
ReportReport
Posted on by

During an import of the modelstore on a model database that contains entries on the new table while building CU7, I receive the fiollowing error:

VERBOSE: The AXUtil command was started in the mode: IMPORTSTORE. VERBOSE: VERBOSE: Working against model store PBZAXSQL01/AX6_DEV_Build_model. VERBOSE: VERBOSE: ERROR: The DELETE statement conflicted with the REFERENCE constraint "FK_ManifestHistoryHasCategoryId". The conflict occurred in database "AX6_DEV_Build_model", table "dbo.ModelOperationHistory", column 'CategoryId'.

I've noticed that this table was introduced in CU7, and that it contains information about model operations.

Deleting the records from the table before performing the modelstore import seems to resolve the problem. However, I don't know how this table is used by the system.

Has anyone had a similar issue ?

Best Regards

 

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    We are facing the same issue when trying to import model store

    Is there a way out to solve this issue?

    regards,

    Narayan

  • Suggested answer
    Tommy Skaue Profile Picture
    Microsoft Employee on at

    Please try to reinitialize the modelstore schema. You can read about on my blog here:

    yetanotherdynamicsaxblog.blogspot.com/.../remember-to-upgrade-modelstore-schema.html

  • Suggested answer
    Stefano Gallo Profile Picture
    on at

    I had already initialized the modelstore schema during the CU7 upgrade. I received the error later on, during the execution of an automated AX build in the modelstore import step.

    The workaround I used to be able to go forward was to execute a straight SQL "delete from ModelOperationHistory", and then teh import worked.

    However, I still don't know how the table is used by the AX framework, and what the logic behind this table is. It would be interesting to know so that I can apply the proper procedure rather than my "workaround".

    Regards

    Stefano

  • Tommy Skaue Profile Picture
    Microsoft Employee on at

    You're right. That is an interesting constraint. You are being blocked from deleting in [ModelOperationHistory] until the referenced categories are first (or cascade) deleted from [ModelManifestCategory].

    Could you please elaborate some more on what steps you have done? You say you are importing a new modelstore to a model database (1st step), then trying to build it using AXBuild (2nd step). Is the AOS running while you import the modelstore?

  • Stefano Gallo Profile Picture
    on at

    Starting from a CU7 upgraded system, these are the steps being executed:

    1) Get the latest sources from VCS and combine them into a single XPO

    2) Import the Standard CU7 upgraded modelstore into the build system.

    3) Create the new target model on the build system using the model manifest file.

    4) Import the label files into the target model.

    5) Import the combined XPO into the target model

    6) Import Visual Studio projects into the target model

    7) Export the target model for later use

    8) Import the deployed modelstore of the "previous build" into the build system to get rid of ID conflicts. This modelstore is CU7 upgraded and AX schema reinitialized.

    9) and so on with the next step...

    10) ...

    The problem occurred during the execution of step 8.

    Regards

    Stefano

  • Tommy Skaue Profile Picture
    Microsoft Employee on at

    Just one more quick question; the AXUtil being used to import the modelstore is the one for CU7, right?

  • Tommy Skaue Profile Picture
    Microsoft Employee on at

    Can you figure out what models have been added/removed by comparing the new modelstore with the old one? I'm just wondering if there is a stored procedure deleting a modelmanifest causing it ty try delete the underlying chained rows.

    You can compare the modelstores by using PowerShell:

    yetanotherdynamicsaxblog.blogspot.com/.../compare-models-in-two-modelstores-using.html

  • Stefano Gallo Profile Picture
    on at

    The AXUtil used is CU7 upgraded, like all components on this installation.

    There is only one (custom) model added during the build process, and at step 8, the ModelOperationHistory table only contained records for this model, with different model ID and Model Manifest ID compared to the the previous build's modelstore. This is normal, because in step 3 we create a new empty model.

    Regards

    Stefano

  • wtc Profile Picture
    20 on at

    I have run into this issue exporting/importing modelstore from QC to production.  We had to run the following command.

    axutil schema /s:servername /db:database_name_model

  • Stefan Franken Profile Picture
    on at

    I could reproduce this issue. In my case I tried to install a exported modelstore with finished CU7 upgrade procedure steps into an empty modelstore (installed database, deleted all models, initialize modelstore).

    deleting the ModelOperationHistory also solves my issue.

    Thanks to Stefano for this.

    Best Regards,

    Stefan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 10

#2
Harisgillani Profile Picture

Harisgillani 4

#2
dserp Profile Picture

dserp 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans