Skip to content

Conversation

@IamMujuziMoses
Copy link
Contributor

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-6418

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@IamMujuziMoses
Copy link
Contributor Author

@dkayiwa @rkorytkowski could you please review this PR, your feedback will be appreciated.

@dkayiwa
Copy link
Member

dkayiwa commented Oct 30, 2025

@IamMujuziMoses did you actually test this out in a running openms webapp to confirm that it works?

@IamMujuziMoses
Copy link
Contributor Author

@dkayiwa how do you mean?

@dkayiwa
Copy link
Member

dkayiwa commented Oct 31, 2025

What is this change supposed to accomplish?

@IamMujuziMoses
Copy link
Contributor Author

@dkayiwa yes, I tested this out in a running openmrs instance successfully

@dkayiwa
Copy link
Member

dkayiwa commented Nov 6, 2025

Other than simply running the webapp, how did you test that these changes do what they are supposed to?

@IamMujuziMoses
Copy link
Contributor Author

@dkayiwa, I have tried to screen record the process, hope these videos help in explaining a bit, they're not very clear, apologies:

  • The first video shows initial startup run, upload test module and a startup without any module version or core version changes.
  • The second video shows a startup with module version and core version changes and a startup with force.setup GP.

Copy link
Member

@rkorytkowski rkorytkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address review comments and add logic for skipping core liquibase changesets in Context.checkForDatabaseUpdaes

});

storeModuleVersion(module.getModuleId(), currentModuleVersion);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much cleaner to put this logic inside a service method. It would run in a transaction this way so runInSingleTransaction would not be needed.

}

protected static String getStoredCoreVersion() {
return Context.getAdministrationService().getGlobalProperty("core.version");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to inject AdministrationService since you already made it a component, but as noted above I would just move the logic to boolean AdministrationService.isModuleSetupOnVersionChangeNeeded(String moduleId) for checking core and modules and similarly boolean AdministrationService.isCoreSetupOnVersionChangeNeeded() for checking just coreVersion and running core liquibase, which you haven't implement yet.


if (versionChanged) {
runInSingleTransaction(() -> {
module.getModuleActivator().setupOnVersionChangeBeforeSchemaChanges(prevCoreVersion, prevModuleVersion);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of this method is to call it before running ANY liquibase changesets, including ones run by core so it should not be here rather in Context.checkForDatabaseUpdates...

@rkorytkowski
Copy link
Member

rkorytkowski commented Nov 28, 2025

Thanks @IamMujuziMoses and I'm sorry for getting back to you after that long. I was away... Please let me know if you are able to work on it within the next week or else I'll take it over and finish up.

@IamMujuziMoses
Copy link
Contributor Author

@rkorytkowski No worries at all, welcome back! Thanks for the review and Yes, I can work on it within the next week. I’ll keep you updated as I progress.

@IamMujuziMoses IamMujuziMoses force-pushed the TRUNK-6418 branch 4 times, most recently from 7f0a355 to 065820b Compare December 3, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants