Repository navigation
sql: also lowercases the zone in record names - #91
Merged
Merged
Conversation
07 lowercased zone names, but 2.x stored '@' as "<zone>." in the zone's own case, so records still spelled the old name: BandL-horizon.com. in zone bandl-horizon.com. powerdns-pipe matches record names exactly, so it never found them, and the web UI showed the wrong owner. 08 rewrites the zone part of absolute names, keeping the host's case, and a bare name equal to the zone. NicTool 2.42 does the same rewrite.
3.x has no releases, so 07 can still change. In one upgrade the record rewrite follows the zone rewrite and compares with the zone as stored, so a live zone 07 leaves in capitals keeps records that match it; a separate 08 lowercased those records regardless.
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified in the focused migration and regression coverage; database-backed tests were not run.
0 open findings
What changed in this PR
Extends migration 07 to normalize the zone portion of existing record names for exact-match consumers.
Changes:
- Rewrites absolute and zone-equal bare names while preserving host case and skipped zones.
- Adds regression coverage, including migration reruns.
- Updates the changelog.
| File | Description |
|---|---|
| sql/upgrade/07_lowercase_zone_names.sql | Adds zone-aware record-name rewrites. |
| sql/schema.test.js | Tests normalization, exclusions, and idempotency. |
| CHANGELOG.md | Documents the expanded migration. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
sql/upgrade/07(#88) lowercased zone names, but not the record names that spell them. 2.x stores@as"<zone>."in the zone's own case, so after 07 a record could readBandL-horizon.com.inside zonebandl-horizon.com. My local snapshot had 48 of these.Who notices:
(nt_zone_id, name)exactly in SQL, so it never answered for those names.ownerForZoneandunqualifyHostcompare withendsWithexactly, so it showed the wrong owner.ownerFqdn(), which lowercases, so they weren't affected.3.x has no releases yet, so this extends 07 rather than adding an 08. After rewriting the zones, 07 now makes two record rewrites:
WWW.Example.com.becomesWWW.example.com.), and the match stops at a label boundary, sonotExample.com.is left alone.Example.combecomes the zone.Both compare the lowercased record name with the zone as stored. A live zone that 07 leaves in capitals, because another live zone has the same name, therefore keeps records that still match it. A separate 08 would have lowercased those records regardless.
07 is still idempotent. NicTool/NicTool#373's upgrade 2.42 makes the same rewrite.
sql/schema.test.jscovers an apex name, a host name, a bare name, a relative name, a name just outside the zone, an already canonical name, a record in a skipped zone, and a re-run.