Skip to content

sql: lowercase existing zone names once - #88

Merged
msimerson merged 6 commits into
mainfrom
zone-lowercase-names
Oct 16, 2026
Merged

msimerson merged 6 commits into
mainfrom
zone-lowercase-names

Conversation

@msimerson

@msimerson msimerson commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Since #84, zone names are stored and matched as zone = ? in canonical form: lowercase, without the trailing dot. 2.x keeps the case it's given, so a zone it stored as VINSCRIPT.COM can't be found by name and doesn't block a new vinscript.com.

sql/upgrade/07_lowercase_zone_names.sql rewrites each such name once.

  • last_modified is kept, so the zone doesn't read as edited.
  • A live zone whose canonical name another live zone already has is left alone. The script ends by listing those for an admin to rename or delete.
  • Deleted zones are rewritten too, since a deleted zone may share a name. Restoring one runs zone: one live zone per canonical name #84's duplicate check.
  • It's idempotent.

sql/schema.test.js covers capitals, a trailing dot, a live pair that would collide, a deleted zone beside a live one, last_modified, and a re-run.

NicTool/NicTool#373 makes 2.x store new names lowercase and adds the same rewrite as its upgrade 2.42. To match, sql/12_nt_options.sql now declares db_version 2.42.

Zone names are matched exactly in their canonical form, lowercase
without the trailing dot. 2.x keeps the case it is given, so a zone it
stored in capitals couldn't be found by its name and didn't block a
second zone of that name.

sql/upgrade/07 rewrites those names, keeping last_modified. A live zone
whose canonical name another live zone already has is left alone and
listed for an admin to resolve.
@msimerson
msimerson requested a balanced review from Copilot October 16, 2026 02:55

This comment was marked as outdated.

NicTool/NicTool#373 makes 2.x store zone names lowercase and adds the
same rewrite as upgrade 2.42. api/sql tracks the 2.x schema, so a new
install declares 2.42.
The report selected live names still not canonical, so it showed the
spelling the rewrite skipped but not the zone it collides with, and
nothing for two live zones already spelled the same. It now lists every
live member of a name more than one live zone shares, before the
temporary table is dropped.
@msimerson
msimerson merged commit e988213 into main Oct 16, 2026
13 checks passed
@msimerson
msimerson deleted the zone-lowercase-names branch October 16, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants