How to prevent database synchronization from deleting data for apps with the same domain models?
We have a single application deployed to multiple environments. The projects associated with each environments contain copies of the other’s modules. So these two projects are the same, except for configurations, etc. We just learned that it’s possible to upload builds from any project and deploy it to the environment of another project. So we’re attempting to have a centralized project that we deploy to multiple environments. Whenever we deploy this centralized project, which is a modular copy like the others, it deletes the contents of the entire database. Any tips on how we can get around this? Edit: I’ve tried restoring the ‘mendixsystem*’ and ‘system*’ tables to the problematic application database, with the goal being to prevent the synchronization all together, but then I receive errors of the type below during compilation. com.mendix.modules.microflowengine.MicroflowException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.IllegalArgumentException: The current id belongs to another object type than the given type to set. Type of this MendixObject is 'EmailTemplate.EmailSettings', the given id is of type 'CommunityCommons.ImageDimensions' Edit: By updating the the short_id columns in the mendixsystem$entityidentifiers table (per this post: https://forum.mendix.com/link/questions/8455) I was able to start up the application. I did this for only the objects that were being retrieved during startup. However, this doesn’t prevent the below error from occurring during runtime, which is similar to the one above. The provided entity id '365' has no corresponding meta object name To resolve the below error I updated all of the short_ids that were missing but upon doing this and attempting to compile, I run into the below modeler error. Mendix.Modeler.M2EEConnector.M2EEException: The server encountered an error. at Mendix.Modeler.M2EEConnector.M2EEResponse.CheckSuccess() in C:\jenkins-ci\workspace\AppStudio3.0-Build\modeler\Mendix.Modeler.M2EEConnector\M2EEResponse.cs:line 57 at Mendix.Modeler.M2EEConnector.StartupManager.PerformStartup(StartupInfo info, IM2EEClient client) in C:\jenkins-ci\workspace\AppStudio3.0-Build\modeler\Mendix.Modeler.M2EEConnector\StartupManager.cs:line 61 at Mendix.Modeler.M2EEConnector.RuntimeController.Start(StartupInfo info, LogLevel autoSubscribeLogLevel) in C:\jenkins-ci\workspace\AppStudio3.0-Build\modeler\Mendix.Modeler.M2EEConnector\RuntimeController.cs:line 133 at Mendix.Modeler.Utility.BackgroundUtil.<>c__DisplayClass1_0`1.<Do>b__0(Object s, DoWorkEventArgs e) in C:\jenkins-ci\workspace\AppStudio3.0-Build\modeler\Mendix.Modeler.Utility\BackgroundUtil.cs:line 28 at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
Every entity in a Mendix app gets an ID in the database, which you’ll find in the mendixsystem or system tables. That ID is used to generate the Mendix IDs used in the ID columns of the tables. When you import a module from one Mendix app to another, it will almost certainly get a different entity ID, and hence generate different object IDs as well.
So, I think the manual overwrite you did to the system tables now means there’s a collision of IDs between two tables/entities. Off the top of my head, I cannot think of a clean way to migrate tables in the way you want.