Maho SQL upgrade scripts #37
Replies: 3 comments 18 replies
-
If you've ever seen this video, it perfectly sums up the experience right now. Working on the EAV code, but first need to update the persistent module, but then need to figure out install script, but then... |
Beta Was this translation helpful? Give feedback.
-
I think it's a great idea as usual, I started coding it, I hope I'll be able to show you something super soon! |
Beta Was this translation helpful? Give feedback.
-
If you're willing to make a major change, I suggest considering moving away from version numbers and instead use dates or arbitrary strings. There are cases where dependencies between modules cause problems such that updates belonging to modules A and B need to be applied in a specific order but using only dependencies and version numbers all of A has to be applied before any of B. Using dates you can say that A.1 applies, then B.1, then A.2, etc. Most if not all mature migration libraries use dates or arbitrary sortable strings like this for a long time. You typically insert a row for each migration rather than just store the latest one so that if a feature with an earlier sort order is merged later, you don't have to rename any files. This has a lot of advantages on busy projects and if a convention is used consistently like a timestamp format it makes it possible to solve dependency issues naturally. You could maintain BC for existing migrations to the new system without having to rename them, keeping compat with third-party modules. For example, say that all new migrations under the new system could be named like
|
Beta Was this translation helpful? Give feedback.
-
How about adding support for
app/code/*/Module_Name/sql/module_setup/maho-install-xx.y.z
files? At first I thought it wasn't a good idea, but then thought about it some more:core_resource
calleddata_version_maho
.Mage_Core_Model_Resource_Setup
, load these files ifdata_version_maho < xx.y.z <= Mage::app()->getMahoVersion()
data_version_maho
to the highestxx.y.z
that ran for that particular resource. Most rows in that table will havedata_version_maho == null
for sometime unless that resource has a maho-install script.Some thoughts:
getMahoVersion()
is 24.11.0, so if I wanted to add an install script in a PR I might name my fileapp/code/core/Mage_Customer/sql/customer_setup/maho-install-24.10.0.php
since it's still October. By using the current month instead of the next expected version, you have flexibility in the release schedule. I.e. if you had named itmaho-install-24.11.0.php
, but then needed to make a release in October, the script wouldn't run24.10.1
, or just merge the two scripts when merging the main branch into the PR. The former would be a problem if it's the release month, since24.11.1
wouldn't be run for the24.11.0
release. So probably stick with the merging them.<version>
nodes in the module'sconfig.xml
Edit: clarified that each module can have their own maho-install scripts, instead of just one huge place for them.
Beta Was this translation helpful? Give feedback.
All reactions