feat(yaps): first lifesigns of the yapping system
Some checks reported warnings
/ phplint (push) Has been cancelled

This commit is contained in:
David Bailey 2025-04-28 10:46:56 +02:00
parent 143c932c88
commit f8af3c5c59
7 changed files with 321 additions and 17 deletions

View file

@ -55,32 +55,33 @@ CREATE TABLE dev_post_markdown (
FULLTEXT(post_markdown)
);
CREATE TABLE dev_feeds (
post_id INTEGER NOT NULL,
feed_key VARCHAR(32),
feed_id VARCHAR(40) NOT NULL,
CREATE TABLE dev_yaps (
yap_id INTEGER AUTO_INCREMENT,
PRIMARY KEY(yap_id),
feed_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
post_path VARCHAR(255) NOT NULL,
yap_category VARCHAR(32) NOT NULL,
yap_tag VARCHAR(40) NOT NULL,
feed_metadata JSON DEFAULT NULL,
-- Uniqueness detection based on associated path, category and tag
yap_hash CHAR(32) AS (MD5(CONCAT(post_path, yap_category, yap_tag))),
CONSTRAINT YAPS_UNIQUE UNIQUE(yap_hash),
feed_text TEXT,
yap_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
yap_metadata JSON DEFAULT NULL,
-- Primary key as true ID to allow for deterministic saving/recreating
CONSTRAINT PK_FEED PRIMARY KEY(post_id, feed_key, feed_id),
FOREIGN KEY(post_id) REFERENCES dev_posts(post_id)
ON DELETE CASCADE,
yap_text TEXT,
-- Make it possible to look up changes from e.g. a commit hash inexpensively
INDEX(feed_id),
INDEX(yap_tag),
-- Make it possible to look up specific post feeds efficiently (e.g. changelog)
INDEX(post_id, feed_key, feed_created_at),
INDEX(post_path, yap_category, yap_created_at),
-- Make it possible to globally look up specific feeds efficiently
INDEX(feed_key, feed_created_at),
INDEX(yap_category, yap_created_at),
-- And just in general, make searching feeds in a timeframe efficient
INDEX(feed_created_at),
INDEX(yap_created_at),
FULLTEXT(feed_text)
FULLTEXT(yap_text)
);
CREATE TABLE analytics_summations (