🐛 Make LoadReservedNameData fixture idempotent#1295
Open
t2d wants to merge 1 commit into
Open
Conversation
Migration Version20260418120000 seeds the `postmaster` and `abuse` reserved names. The basic fixtures (loaded with --append by `make fixtures`) re-insert the same names, causing a duplicate-key violation on `reserved_names` and breaking local environment setup on any migrated DB. Skip reserved names that already exist before persisting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Member
|
Fixtures must not be idempotent. The idea is to prefill the system with a fixed set of data. If you need to reapply, you need to purge the database and start fresh. |
Contributor
Author
|
The docs say I should do |
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.



Problem
make fixturesfails on any migrated database:Migration
Version20260418120000("Migrate postmaster aliases to settings and ensure reserved names exist") seeds thepostmasterandabusereserved names.LoadReservedNameData(groupbasic) insertsadmin, root, postmaster, abuse, webmaster. Sincemake fixturesloads with--append(no purge), the overlapping names collide → duplicate-key crash.Fix
LoadReservedNameData::loadnow skips names already present before persisting, keeping the fixture idempotent under--append.Verification
doctrine:fixtures:load --group=basic --appendsucceeds against a DB already seeded by the migrationreserved_namesends with exactly one row per name (admin, root, postmaster, abuse, webmaster)composer cs-fix(no changes),composer psalm(no errors),composer rector-check(OK)Found while setting up local env for #1293; unrelated to that change.
🤖 Generated with Claude Code