Skip to content

ADFA-5469: Regenerate docdb-studio's SCHEMA.md from a real database - #32

Open
davidschachterADFA wants to merge 1 commit into
mainfrom
task/ADFA-5469-refresh-schema-doc
Open

ADFA-5469: Regenerate docdb-studio's SCHEMA.md from a real database#32
davidschachterADFA wants to merge 1 commit into
mainfrom
task/ADFA-5469-refresh-schema-doc

Conversation

@davidschachterADFA

@davidschachterADFA davidschachterADFA commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Refreshes docdb-studio/SCHEMA.md, which had been the original .schema dump from when docdb-studio was added and was never updated since.

Why

Working ADFA-5469 (dropping the quotes from Templates' and BookCategories' UNIQUE constraints) I came here to check the canonical schema and found most of it missing. Against a current production database, SCHEMA.md was missing:

  • Templates, BookCategories, Bookshelf
  • CompressionDictionary (ADFA-5153), DocumentationDatabaseVersion (ADFA-5220)
  • the six PUCC_* tables
  • both triggers (AddBook, DeleteBook)
  • Content.templateId

and still listed ide_tooltip_table, which no longer exists. This repo's own CLAUDE.md already flags the file as "closest of the three documented schemas to reality, but still out of date."

What changed

Regenerated from sqlite_master rather than the sqlite3 CLI's .schema, which invents an IF NOT EXISTS for any table whose stored name is quoted — both "Content" and "Tooltips" are, from old renames, and the previous revision carried those phantom clauses. The file is now byte-for-byte what SQLite has stored, so it can be diffed directly against a live file. The header carries the one-liner to regenerate it.

Verification

Replaying the file into an empty database and diffing sqlite_master against the source it came from matches exactly.

On the quoted identifiers still in here

Content's UNIQUE('path'), Tooltips' UNIQUE ('categoryId', 'tag') and quoted column definitions, and the same in TooltipButtons/TooltipButtonNumbers are all still present — deliberately, because they are still true of the database. None is a correctness bug: SQLite resolves a string literal in that position back to the column (quirk 3), confirmed with PRAGMA index_info. ADFA-5470 tracks clearing them, and is a separate ticket mainly because AddBook is an AFTER INSERT ON Content trigger — a naive row copy during a rebuild fires it once per PDF and corrupts Bookshelf.

The dump was taken from a database with CodeOnTheGo's docs/docdb/ADFA-5469-unquote-unique-constraints.sql applied, so Templates and BookCategories read UNIQUE(name)/UNIQUE(category). The header says so, and says what an unpatched copy looks like instead.

The PUCC_* tables are included because this is a faithful dump; the header repeats that they are unrelated to documentation tooling and should not be maintained.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XUrEYQWbNoZ4ahryL3ysPi

The file was a `.schema` dump taken when docdb-studio was first added and
never refreshed. It was missing Templates, BookCategories, Bookshelf,
CompressionDictionary, DocumentationDatabaseVersion, the six PUCC_*
tables, both triggers and Content.templateId, and still listed
ide_tooltip_table, which no longer exists -- so most of what a
maintainer would come here to check was either absent or wrong.

Regenerated from sqlite_master rather than the sqlite3 CLI's `.schema`,
which invents an `IF NOT EXISTS` for any table whose stored name is
quoted (both "Content" and "Tooltips" are, from old renames). The dump
is now byte-for-byte what SQLite has stored, so it can be diffed against
a live file; verified by replaying it into an empty database and
diffing sqlite_master against the source, which matches exactly. The
header carries the one-liner to regenerate it.

Taken from a database with CodeOnTheGo's
docs/docdb/ADFA-5469-unquote-unique-constraints.sql applied, so Templates
and BookCategories read UNIQUE(name)/UNIQUE(category) here; the header
says so and says what an unpatched copy looks like instead. Content,
Tooltips, TooltipButtons and TooltipButtonNumbers still show their
quoted identifiers because that is still true of the database -- ADFA-5470
tracks clearing them, and the header notes the AddBook trigger that makes
a Content rebuild more than a row copy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XUrEYQWbNoZ4ahryL3ysPi
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.

1 participant