ADFA-5469: Regenerate docdb-studio's SCHEMA.md from a real database - #32
Open
davidschachterADFA wants to merge 1 commit into
Open
ADFA-5469: Regenerate docdb-studio's SCHEMA.md from a real database#32davidschachterADFA wants to merge 1 commit into
davidschachterADFA wants to merge 1 commit into
Conversation
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
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.
Refreshes
docdb-studio/SCHEMA.md, which had been the original.schemadump from when docdb-studio was added and was never updated since.Why
Working ADFA-5469 (dropping the quotes from
Templates' andBookCategories'UNIQUEconstraints) I came here to check the canonical schema and found most of it missing. Against a current production database,SCHEMA.mdwas missing:Templates,BookCategories,BookshelfCompressionDictionary(ADFA-5153),DocumentationDatabaseVersion(ADFA-5220)PUCC_*tablesAddBook,DeleteBook)Content.templateIdand still listed
ide_tooltip_table, which no longer exists. This repo's ownCLAUDE.mdalready flags the file as "closest of the three documented schemas to reality, but still out of date."What changed
Regenerated from
sqlite_masterrather than the sqlite3 CLI's.schema, which invents anIF NOT EXISTSfor 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_masteragainst the source it came from matches exactly.On the quoted identifiers still in here
Content'sUNIQUE('path'),Tooltips'UNIQUE ('categoryId', 'tag')and quoted column definitions, and the same inTooltipButtons/TooltipButtonNumbersare 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 withPRAGMA index_info. ADFA-5470 tracks clearing them, and is a separate ticket mainly becauseAddBookis anAFTER INSERT ON Contenttrigger — a naive row copy during a rebuild fires it once per PDF and corruptsBookshelf.The dump was taken from a database with CodeOnTheGo's
docs/docdb/ADFA-5469-unquote-unique-constraints.sqlapplied, soTemplatesandBookCategoriesreadUNIQUE(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