feat: add page view log

This commit is contained in:
KazooTTT
2024-11-23 21:29:56 +08:00
parent ff5a3a50bd
commit b040521893
5 changed files with 73 additions and 17 deletions

View File

@ -0,0 +1,13 @@
-- Create pageview_logs table for detailed analytics
CREATE TABLE IF NOT EXISTS pageview_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
slug TEXT NOT NULL,
ip_address TEXT,
user_agent TEXT,
referrer TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Create index on slug and created_at for efficient querying
CREATE INDEX IF NOT EXISTS idx_pageview_logs_slug ON pageview_logs(slug);
CREATE INDEX IF NOT EXISTS idx_pageview_logs_created_at ON pageview_logs(created_at);