-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/release#16 - Allow omission of empty upgrade steps #19743
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Often, when setting up the initial beta and when setting up the final stable release, there are no upgrade steps. However, we're required to create the files anyway to ensure that the upgrader continues to work normally. As a byproduct, we create a large number of empty incremental steps. When running the web-based upgrade, each incremental step requires 3x AJAX calls. This adds up. Before ----------- The revision sequence -- and the final DB version-number -- are strictly determined by the list of `X.Y.Z.mysql.tpl` files. If you omit a file, then it will not execute corresponding PHP code, and it will not set the final version in DB. After ----------- The revision sequence is more forgiving -- it will recognize any revision number that is defined in either `X.Y.Z.mysql.tpl` or `function upgrade_X_Y_Z()`. Additionally, it is not necessary for the final version number to appear in the incremental revision list. This patch enables a slightly different workflow for developing updates: 1. Set the new version in `xml/version.xml`. 2. If (and only if) you need some patch-level incremental work, then create a file `X.Y.Z.mysql.tpl` or create a function `function upgrade_X_Y_Z()` (or both).
…version declarations
* If the release is an alpha, then create SQL file by default. * If the release is beta or stable, then don't create by default. * If the CLI user specificaly says `--sql` or `--no-sql`, then abide by that.
(Standard links)
|
I did the following test
the only differences are dates in the tables
Based on the above this 'does no harm' and I'm going to merge it. However, the above test did not pass on the fail on patch (there was a hard fail) so there might be another step of so in there |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR prepares to streamline the upgrader steps - by making it possible to skip increments which do not actually require DB updates.
(A companion PR will be opened momentarily to remove a large batch of old/unnecessary increments.)
ping @colemanw re: https://lab.civicrm.org/dev/release/-/issues/16
Before
(General) Often, when setting up the initial
X.Y.beta1
and when setting up the finalX.Y.0
stable release, there are no upgrade steps. However, we're required to create the files anyway to ensure that the upgrader continues to work normally. As a byproduct, we create a large number of empty incremental steps. Each incremental step requries 3x AJAX calls in the web-based upgrader -- so this adds up.(Technical) The incremental revision sequence -- and the final DB version-number -- are strictly determined by the list of
X.Y.Z.mysql.tpl
files. If you omit a SQL file, then it will not execute corresponding PHP code, and it will not setthe final version in DB appropriately.
After
(General) The upgrader does not need SQL files for every
X.Y.Z
revision.(Technical) The incremental revision sequence is determined by scanning both the list of
X.Y.Z.mysql.tpl
files and the list ofupgrade_X_Y_Z()
functions. It is valid to have a version which uses both, either, or neither. In cases where neither style of increment is used, it will still set the final version appropriately.Technical Details
Writing upgrade steps has always been a bit particular. This is now slightly more robust, but some quirks remain, so it may be worth summarizing the resulting behavior. You may do any of these::
vX.Y.Z
with only a fileX.Y.Z.mysql.tpl
. The SQL script is called automatically.vX.Y.Z
with only aupgrade_X_Y_Z()
step. The PHP function is called automatically.vX.Y.Z
with both functionupgrade_X_Y_Z()
and fileX.Y.Z.mysql.tpl
. The flow-control for PHP takes precedence, and it decides if/when to call the SQL file.vX.Y.Z
without any incremental upgrade steps. This only makes sense for the HEAD version. The UI+DB will be updated to reflect the new number, but no incremental steps are actually executed.This allows us to change the default policy (
set-version.php
) with respect to initializing upgrade files:X.Y.alpha1
release, it will create a skeletalFiveUmpteen.php
, create a skeletalX.Y.alpha1.mysql.tpl
, and bumpxmll/version.xml
. (Most schema changes occur during alpha1.)X.Y.beta1
orX.Y.0
release, it will only bump upxml/version.xml
. It does not (by default) create any PHP or SQL files.Comments
This slightly affects the workflow for a developer who seeks to change the upgrader during RC/beta/stable. (They need to manually bump the version and create any SQL files -- there is no pre-existing skeleton.) When this is merged, we need to send a PSA to
civicrm-dev@
.If you want to inspect what it does with different commits (eg pre/post patch) or with some local hacks to the upgrade-steps, then these commands may be interesting:
I have not done much in the way of end-to-end validation. There should be a question-mark with respect to
4.4.7
-- that file does not load right now (because the loading process requires the currently-non-existentFourSeven.php
).