Is it a problem if I use module versions like
As Marius explained, Magento uses the version_compare() function. The documentation describes how it works:
The function first replaces _, - and + with a dot . in the version strings and also inserts dots . before and after any non number so that for example '4.3.2RC1' becomes '4.3.2.RC.1'. Then it compares the parts starting from left to right. If a part contains special version strings these are handled in the following order: any string not found in this list < dev < alpha = a < beta = b < RC = rc < # < pl = p. This way not only versions with different levels like '4.1' and '4.1.2' can be compared but also any PHP specific version containing development state.
1.1.2-devmasteris normalized to
1.1.2-branch-foobaris normalized to
1.0 < 1.0.1)
1.1.2.devmaster.0 > 1.1.2.branch.foobarbecause according to the order
devmaster = branchand
foobar < 0
1.1.2 > 1.1.2-devmasterbecause
devmaster < 0
1.1.2-dev-master = 1.1.2-dev-foobarbecause
master = foobar
1.1.2-dev-master > 1.1.2-branch-foobarbecause
dev > branchand
master = foobar(see special meaning of "dev")
While you can use arbitrary strings, they might not behave as you expect if you don't use a standard format.
Be especially careful with upgrade scripts. Some different strings will be treated as equal, others not. Upgrade scripts are only triggered if the old version is less than the new version.
So for example, it's possible to have an upgrade script
upgrade-1.1.2-branch-foobar-1.1.2.php but not
I don't see a value in defining a version like
dev-master. In composer, this is a dynamic version, which you can require as a dependency, but it always maps to a real version (or at least, a real commit), you would never define it as package version number.
You might want to try to use branch suffixes to prevent conflicts that happen when you update the version in two branches at the same time. So instead of two scripts
upgrade-1.0.0-1.0.1.php that need to be merged carefully, you would have
upgrade-1.0.0-1.0.0-feature-bar.php and then when merging the feature branches, you add
upgrade-1.0.0-feature-foo-1.0.1.php to apply the respective missing update scripts to each branch.
This is a cool idea but it won't work. Here's why: The upgrade scripts are collected in
Mage_Core_Model_Resource_Setup such that the available scripts are ordered using
version_compare() on the first version string in the filename. There is no equality comparison with the current version other than with
version_compare. This means,
1.0.0-feature-foo are treated equal and if you are at one of those versions and have the scripts mentioned above, it's not determined which of them is executed.
Also, the upgrade scripts must have exactly one dash
upgrade-, which is used to split between from-version and to-version. But you could work around that with using the normalized version strings
From the technical point of view it works but I wouldn't recommend it.
Magento compares module versions using
See this method:
version_compare() 'compares two "PHP-standardized" version number strings'.
If you start naming the versions like that ... it's an easy way to end up in chaos.
As far as I know Magento does use the numbers (version) to decide if the SQL installs need to be executed. With these kind of versions I don't think it can figure out if an update was installed