feat: ✨ transition to time-block based access count storage, including referrer storage
This commit is contained in:
parent
35ff4951ad
commit
a4fe4c4489
2 changed files with 31 additions and 30 deletions
|
@ -12,6 +12,8 @@ CREATE TABLE posts (
|
|||
post_create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
post_update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
post_access_count INTEGER DEFAULT 0,
|
||||
|
||||
post_metadata JSON NOT NULL,
|
||||
post_settings_cache JSON DEFAULT NULL,
|
||||
|
||||
|
@ -20,24 +22,22 @@ CREATE TABLE posts (
|
|||
PRIMARY KEY(post_id),
|
||||
CONSTRAINT unique_post_path UNIQUE (post_path),
|
||||
|
||||
INDEX(post_path, post_update_time),
|
||||
INDEX(post_path, post_create_time),
|
||||
INDEX(post_path_depth, post_path)
|
||||
INDEX(post_path),
|
||||
INDEX(post_path_depth, post_path),
|
||||
INDEX(post_create_time),
|
||||
INDEX(post_update_time)
|
||||
);
|
||||
|
||||
CREATE TABLE path_access_counts (
|
||||
access_time DATETIME NOT NULL,
|
||||
post_path VARCHAR(255),
|
||||
agent VARCHAR(255),
|
||||
|
||||
path_last_access_time DATETIME NOT NULL
|
||||
DEFAULT CURRENT_TIMESTAMP
|
||||
ON UPDATE CURRENT_TIMESTAMP,
|
||||
referrer VARCHAR(255),
|
||||
|
||||
path_access_count INTEGER DEFAULT 0,
|
||||
path_processing_time DOUBLE PRECISION DEFAULT 0,
|
||||
|
||||
PRIMARY KEY(post_path, agent),
|
||||
INDEX(path_last_access_time)
|
||||
PRIMARY KEY(access_time, post_path, agent, referrer)
|
||||
);
|
||||
|
||||
INSERT INTO posts (post_path, post_path_depth, post_metadata, post_content)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue