everything(everything): simply saving work

This commit is contained in:
David Bailey 2024-08-15 22:53:55 +02:00
parent 0f2761cd61
commit 76ca7b9c32
25 changed files with 1330 additions and 561 deletions

View file

@ -3,35 +3,59 @@ CREATE DATABASE dragon_fire;
USE dragon_fire;
-- DROP TABLE posts;
-- DROP TABLE path_access_counts;
-- DROP TABLE path_errcodes;
-- DROP TABLE feed_cache;
CREATE TABLE posts (
post_id INTEGER AUTO_INCREMENT,
host VARCHAR(64) NOT NULL,
post_path VARCHAR(255) NOT NULL,
post_path_depth INTEGER NOT NULL DEFAULT 0,
post_create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
post_update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
post_created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
post_updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
post_access_count INTEGER DEFAULT 0,
post_view_count INTEGER DEFAULT 0,
post_metadata JSON NOT NULL,
post_title VARCHAR(1024),
post_tags VARCHAR(1024),
post_brief TEXT(2048),
post_metadata JSON DEFAULT NULL,
post_settings_cache JSON DEFAULT NULL,
post_content MEDIUMTEXT,
PRIMARY KEY(post_id),
CONSTRAINT unique_post UNIQUE (host, post_path),
INDEX(host, post_path),
INDEX(post_path_depth, post_path),
INDEX(post_create_time),
INDEX(post_update_time)
INDEX(host, post_path_depth, post_path),
INDEX(host, post_created_at),
INDEX(host, post_updated_at),
FULLTEXT(post_tags)
);
CREATE TABLE post_markdown (
post_id INTEGER,
post_markdown TEXT,
PRIMARY KEY(post_id),
FOREIGN KEY(post_id) REFERENCES posts(post_id)
ON DELETE CASCADE,
FULLTEXT(post_markdown)
);
CREATE TABLE path_access_counts (
access_time DATETIME NOT NULL,
host VARCHAR(64) NOT NULL,
post_path VARCHAR(255),
agent VARCHAR(255),
referrer VARCHAR(255),
@ -42,6 +66,17 @@ CREATE TABLE path_access_counts (
PRIMARY KEY(access_time, host, post_path, agent, referrer)
);
CREATE TABLE path_errcodes (
access_timestamp DATETIME NOT NULL,
host VARCHAR(64) NOT NULL,
post_path VARCHAR(255),
agent VARCHAR(255),
referrer VARCHAR(255),
error VARCHAR(1024),
);
CREATE TABLE feed_cache (
host VARCHAR(64) NOT NULL,
search_path VARCHAR(255),