docs: add SQL schema documentation - #8493
Conversation
| starred INTEGER DEFAULT 0, | ||
| timestamp_sent INTEGER DEFAULT 0, -- Timestamp of the message as sent in the Date header. | ||
| timestamp_rcvd INTEGER DEFAULT 0, | ||
| hidden INTEGER DEFAULT 0, |
There was a problem hiding this comment.
This is a bad column, needs a good documentation.
In many cases the message should be trashed instead of hiding. Hiding is used for rare cases when you want the message to be "in the chat" so they are marked as seen. One is reactions, but there was something else, i think location streaming. Would be great to deprecate it somehow or at least discourage more usage of it. The problem with such hidden messages is that it is unclear when they are supposed to be cleaned up and they likely slow down chat loading if you have lots of reactions in the chat.
8e4c7f3 to
4e7ee48
Compare
|
Quite like it. I didn't review the comments except in passing (maybe @r10s is also a review authority to reckon with there :), but did a PR #8514 to make the schema become tested in CI. I wonder if we could evolve to introduce an env |
606d56d to
8bafac5
Compare
There is currently no place to document up to date SQL schema. New database is initialized with src/sql/tables.sql and then updated by migrations, So tracking down how some column is used requires grepping the code, looking for a migration adding it and corresponding commits. The documentation is frozen at version 160. Ideally it should be updated when adding a migration, but most of the value is documenting old stable tables. There was an idea to automatically check if the documentation corresponds to the database schema, but there is no tool to compare the schema. SQLite itself stores database schema as the text in the schema table, with columns appended later without any formatting. Even SQLite REPL which has ".schema --indent" option does not handle the comments properly and produces invalid SQL with closing parenthesis commented out.
finds things like "exists in the db, but is not documented" or "documented but not in the db".
8bafac5 to
7ac86fc
Compare
There is currently no place to document up to date SQL schema. New database is initialized with src/sql/tables.sql and then updated by migrations,
So tracking down how some column is used requires grepping the code, looking for a migration adding it and corresponding commits.
The documentation is frozen at version 160.
Ideally it should be updated when adding a migration, but most of the value is documenting old stable tables.
There was an idea to automatically check
if the documentation corresponds to the database schema, but there is no tool to compare the schema.
SQLite itself stores database schema as the text
in the schema table, with columns appended later
without any formatting.
Even SQLite REPL which has ".schema --indent" option does not handle the comments properly
and produces invalid SQL
with closing parenthesis commented out.