Make country native field required with name fallback. - #67
Closed
victore13 wants to merge 2 commits into
Closed
Conversation
If native is not provided in JSON data, it falls back to the country name. Changelog: changed
The previous change made `native` NOT NULL by editing the create-table migration, which only affects fresh installs — production databases that already ran it kept the column nullable, so the constraint was never applied where it mattered. - Add a dedicated ALTER migration (0000_03_07_190513) that backfills existing null natives from `name` (mirroring the seeder's `native ?? name` fallback) and then enforces NOT NULL. Guarded for idempotency, so it is a safe no-op on fresh installs and reversible via down(). - Fix the single source-data gap: Cote D'Ivoire (CI) had native = null in countries.json; set it to "Côte d'Ivoire" so the seeded data is correct at source, not only via the runtime fallback. - Add a schema test asserting `native` is non-nullable after migration. No primary keys or existing rows are altered; the migration only touches the `native` column definition and null values. Changelog: changed Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 15, 2026
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.
The
nativefield on countries is now required instead of nullable. If the source JSON doesn't provide a value fornative, thenamefield is automatically used as a fallback.Changes
nativeis no longernullable()fromJsonToDBRecord()uses$jsonItem['native'] ?? $jsonItem['name']string|nulltostringnativefield in translations testRationale
Ensures all countries always have a native name available, simplifying data consumption without needing to handle null values.