check if schema version has changed against the old version #16574
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.
Description
A rough outline of what’s going on:
This will happen if
src/services/ProjectConfig->areChangesPending(true)
in thesrc/console/controllers/MigrateController->runAction()
returnstrue
, in which case we “allow project config changes, but don’t overwrite the pending changes”. When testing I had bothdevMode
andallowAdminChanges
set tofalse
.In the above case:
migrate/all --no-content
goes through fine untilEVENT_AFTER_REQUEST
gets triggered;ProjectConfig->flush()
get triggered (it can be enqueued by, e.g.ProjectConfig->set()
which callsProjectConfig->_saveConfigAfterRequest()
).flush()
callswriteYamlFiles()
, which writes to files the config we got fromgetCurrentWorkingConfig()
, which at the end ofmigrate/all
can still have “old”version
andschemaVersion
valuesCurrent working config can still have the “old”
schemaVersion
value because of those lines (and those for the plugins).(In terms of 4 to 5 upgrade, the first thing that calls
src/services/ProjectConfig->set()
iscraft/migrations/m230524_220029_global_entry_types->safeUp()
.With 5.5.x to 5.6.x, there’s the
src/migrations/m241125_122914_add_viewUsers_permission
that also adjusts the project config.)Steps to reproduce
(php 8.2; mysql 8.0)
devMode
andallowAdminChanges
totrue
; ensure you're on a Pro version;group1
) with permission to access the control panel and to edit usersddev php craft migrate/all --no-content
ddev php craft project-config/touch
config/project
folderdevMode
andallowAdminChanges
tofalse
ddev php craft migrate/all --no-content
config/project/project.yaml
- thesystem.schemaVersion
will be set to5.5.0.0
, and it should be5.6.0.2
Now you can use steps 8-12 to keep reproducing this over and over
Related issues
#16086