Track the plugin of executed seeds in cake_seeds#1107
Open
dereuromark wants to merge 2 commits into
Open
Conversation
Seed classes are not namespaced, so deriving the plugin from the class name never matched and plugin seeds were logged with a null plugin. The plugin of the current run is used instead, matching how migrations are tracked. Because of the null plugin, plugin seeds were also never detected as executed, so they ran again on every seeds run and were skipped by seeds reset. Seed log entries written before this fix are still matched for plugin seeds so that they are not executed a second time.
This file contains hidden or 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
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.
Fixes #1106
Seeds executed from a plugin were logged into
cake_seedswithplugin = NULL.The plugin was derived from the seed class name, but seed classes are not namespaced (see
templates/bake/Seed/seed.twig), sostr_contains($className, '\\')was always false and the plugin was alwaysnull. The same broken detection existed in four places:AbstractAdapter::seedExecuted()- wrong insertAbstractAdapter::removeSeedFromLog()- deletedplugin IS NULLrows onlyManager::isSeedExecuted()- plugin seeds were never detected as executed, so they re-ran on everyseeds runand were skipped byseeds resetSeedStatusCommand::execute()- plugin seeds always reported as pendingAll four now use the plugin of the current run (
Util::getSeedPlugin()), the same source migrations already use.Backwards compatibility
Entries written before this fix carry
plugin = NULLfor plugin seeds. To avoid re-running seeds that already ran, aNULLentry still matches when looking up a plugin seed, andseeds reset --pluginremoves those entries too. The trade-off: an application seed sharing its name with a plugin seed can be matched as well. That is preferred over re-running a non-idempotent seed and duplicating data.