fix(db): make Blogs.BlogId the only blog ID and drop BlogNames
Blogs.BlogId was a one-time copy of BlogNames and nothing kept it current: 12,238 blogs first seen after 2026-08-07 had a BlogNames ID but a NULL Blogs.BlogId, so GetBlogs' join on BlogId silently skipped them and their 23,148 notes. - retire-blognames.sql: stub Blogs rows for the 17 unregistered note participants, backfill IDs (none renumbered), make ix_Blogs_BlogId UNIQUE, drop BlogNames, and add triggers that stop a Blogs row with a BlogId from being deleted, renamed or renumbered - AddNote registers both blogs via RegisterBlog (Blogs row + MAX+1 ID) and every query resolves names through Blogs instead of BlogNames - verify-db-schema.sql reports a DB that still has BlogNames (1e) - Update TL.db.md, AGENTS.md and the DB Browser saved queries Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -15,9 +15,9 @@ ORDER BY
|
||||
FROM
|
||||
Notes N
|
||||
inner JOIN
|
||||
BlogNames rbn on rbn.BlogId = N.RootBlogId
|
||||
Blogs rbn on rbn.BlogId = N.RootBlogId
|
||||
inner JOIN
|
||||
BlogNames nbn on nbn.BlogId = N.NoteBlogId
|
||||
Blogs nbn on nbn.BlogId = N.NoteBlogId
|
||||
inner JOIN
|
||||
NoteTypes t on t.TypeId = N.TypeId
|
||||
inner JOIN
|
||||
|
||||
Reference in New Issue
Block a user