This repository has been archived by the owner on Dec 22, 2021. It is now read-only.
forked from nielsandriesse/session-open-group-server
-
Notifications
You must be signed in to change notification settings - Fork 11
Conversation
This file contains 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
msgmaxim
reviewed
Sep 14, 2021
msgmaxim
reviewed
Sep 27, 2021
msgmaxim
reviewed
Sep 30, 2021
darcys22
reviewed
Oct 1, 2021
jagerman
force-pushed
the
db-refactor
branch
3 times, most recently
from
October 4, 2021 19:02
ff11c1a
to
9de5be7
Compare
Completely overhauls the underlying database design: - referential integrity - data normalization - using triggers for various updates to reduce the amount of data logic in code. - indexes - one single database rather than 1 + 1/room - various structural improvements for useful features such as: - individually and default-assignable read/write/upload - time-based permission expiries (e.g. restrict this permission for x amount of time) - distinguishing between admins (who can add/remove moderators) and moderators (who can only moderate but not control the moderator list) - global server moderators/admins - global server bans - single VIEW for simple querying of a user's effective permissions (i.e. with database-side coalescing of global/local permissions). - pinned message via foreign key - room icon as a regular uploaded file - per-file file expiries (so that admins/mods can upload non-expiry files, such as the room icon, or pinned downloads). - message history so that when messages get edited or deleted a log is kept of the old value (the idea being that mods would be able to look this up). - movable messages (e.g. so there could be a "bad posts" room that only moderators have access to).
"due to" works as an adjective that follows a noun (not verbs/verb phrases) and is being used incorrectly in all the error messages fixed here.
- "Deleted" messages should be set to null, not actually deleted - Add automatic updating of "edited" to the message update trigger - Accomodate janky deprecated Session compact_poll logic that expects deletion lists even if it doesn't ask for them. - Add a useful view for (admin direct sqlite) message querying. - Fix message_details VIEW query
Uploaded room images shouldn't expire; this makes the expiry column nullable and sets their expiry to null, and adds a trigger to expire replaced room images. Also fixes a panic in file deletion that made it not actually delete files.
Trim padding when storing and repad on the fly when retrieving.
They have to be defined after the tables on which they run, of course. Also fixed some syntax errors in them and made them work.
The old Room response included the room token as "id", which is quite awkward, and not something we want to propagate into the future API, so we can't just start returning the extra details if we don't want to maintain that misnaming. This changes the API so that existing (deprecated) endpoints get the deprecated field, and the new Room deserialization is free to break backwards compat.
- Rename `info_updated` -> `info_updates` to be consistent with `updates`. - Relax triggers to only update `info_updates` instead of both updates and info_updates, and fix some trigger statements that were updating the wrong value. - Add table for tracking (multiple) pinned messages. - Trigger info_updates update when pinning/unpinning.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Completely overhauls the underlying database design (see the added src/schema.sql):
Still a bunch TODO on this:
exposing endpoints for potential new functionalitywill come in a later PR.