Repository navigation
docs: add database schema design post - #638
Open
faisalahammad wants to merge 3 commits into
Open
faisalahammad wants to merge 3 commits into
faisalahammad wants to merge 3 commits into
Conversation
- Add v2 table definitions for messages, queue and subscriptions - messages.id is now auto_increment, channel_title is removed and message is text - queue gets context and created_at, primary key (user_id, message_id) - subscriptions gets created_at, primary key (user_id, channel_name) - channel_name is varchar(64) everywhere - Fresh installs create v2 tables, DB version is now 2 - Add schema tests and update the database schema docs The v1 schema had no auto_increment on messages.id, so the second message insert failed with a duplicate key error. The queue and subscriptions tables also had no primary key, so the same row could be stored many times. v1 methods are kept for the upgrade in WordPress#616. Fixes WordPress#615
Drop channel_title, keep expires_at and severity out of meta, and raise the message limit to TEXT size (65,535 bytes).
Add a Storybook page that explains the v2 schema and the reasons behind it, as a draft for the Make Core post. Also update the schema and translations pages so they match the v2 tables. Refs WordPress#391
This branch has not been deployed
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.
What?
Adds a "Database Schema Design" page to Storybook. It explains how notifications are stored in the v2 tables and why the tables look the way they do. The text is meant as a draft for the Make Core post asked for in #391.
It also updates the "Database Schema" and "Translations" pages so they match the v2 schema.
Refs #391
Depends on #637. This branch is built on top of
fix/615-database-schema-v2, so the diff also shows the 2 commits from #637 until that one is merged. Only the last commit (docs: add database schema design post) belongs to this PR.Why?
#391 asks to review the schema doc, make sure it is up to date, and prepare a post that explains the design. The old docs had a few things that did not match the code anymore, for example a channel
roleproperty, a channels table and thetitle_key/message_keytranslation idea.How?
storybook/stories/docs/database-schema-design.mdwith the post, anddatabaseSchemaDesign.stories.mdxto show it under Documentation. It covers the flow from emit to the queue, why messages and the queue are split, one message row per locale, why there is no channels table, keys and indexes, dates in UTC,metaas JSON text, text sizes, expiry and cleanup, upgrades, and open questions for feedback.database-schema.md: links to the new page, removes the channelroletext and the channels table, fixes the nestedmetalist and a few wording issues.translations.md: now says the translated text is stored with one message row per locale, and the channel title comes from the registry.The post says clearly that emitting, snoozing, the repositories and the REST endpoints are still being built, and that v1 installs are not upgraded until #616.
I kept it as "Refs" and not "Fixes", because the post still needs to be published on Make Core.
Testing Instructions
npm installandnpm run start --workspace=storybook.metalist is nested, and there is no channelroletext.title_key/message_key.*_v2()methods inincludes/database/class-schema.php.npx wp-scripts lint-md-docspasses on the three markdown files.Screenshots or screencast
Docs only, no UI changes in the plugin.