Closed maaarghk closed 1 year ago
Hi @maaarghk,
Thank you for reporting this to us!
Indeed, the setup version and the module version are two separate concepts, where the setup version represents the version of the module's database schema and is used by Magento to manage database changes.
If the setup version is not bumped and there are no database schema changes in the release, running bin/magento setup:upgrade
would not cause any changes to the database. However, it is still recommended to run the upgrade command as part of the deployment process to ensure that any other necessary tasks related to the module installation or upgrade are executed.
So, while it may not be strictly necessary to bump the setup version if there are no database changes, it is generally considered good practice to keep the setup version aligned with the module version to maintain consistency and avoid potential issues in the future. It also ensures that any potential setup actions, beyond just database changes, are executed correctly.
We will discuss the proposed approach internally and I will update this issue accordingly.
Kind regards, Rok
@RokPopov what is your source for the following?:
it is generally considered good practice to keep the setup version aligned with the module version to maintain consistency
Hi @lrotherfield-function,
While Magento does not explicitly mandate that the setup version must always match the module version, aligning them can help maintain consistency and clarity in versioning. When the module version and setup version are the same, it is easier to understand the relationship between the code and the corresponding database schema.
This practice can also help avoid confusion and potential issues in situations where the module version and setup version diverge. For example, if a module version is updated but the setup version remains the same, it may lead to incorrect assumptions about the existence of database changes or the need for running setup scripts.
However, it's important to note that Magento's official documentation does not enforce a strict guideline regarding the alignment of module and setup versions. The decision to keep them aligned or not ultimately depends on the specific project requirements and development practices.
As mentioned, we will discuss your proposal internally, afterwards the issue will be updated with our decision.
Cheers, Rok
Hi @maaarghk, @lrotherfield-function
Turns out the setup_version bump is a hard requirement when releasing on Adobe Commerce Marketplace.
I will be closing this issue for now.
Cheers, Rok
Hey, just taking a look here: https://github.com/Adyen/adyen-magento2/compare/8.18.0...8.18.1 before doing an upgrade and I noticed that in #2042 setup_version on the module definition in
etc/module.xml
was bumped to match the module version.Module version and setup version are two separate concepts, there's no need to bump the setup_version unless the database schema changes or there are actions to be taken by an install / upgrade class.
If the setup version is not bumped, then
bin/magento setup:db:status
will return that no changes are required and it is safe to do a deploy without runningbin/magento setup:upgrade
; however, when the setup version is updated, then Magento will refuse to run the new release unlessbin/magento setup:upgrade
is run first. This enables maintenance mode and takes a few minutes, causing downtime.In short, if setup_version is bumped but there are no setup actions to take, then the downtime caused by upgrading the plugin is totally unnecessary.
Cheers.
M
p.s.: at some point someone was aware of this : ) https://github.com/Adyen/adyen-magento2/issues/855