P0 blockers: - Fix migration numbering conflict and duplicate indexes - Change comments.post_id FK to ON DELETE CASCADE - Restrict public post detail endpoint to published posts only - Fix rate-limiting IP extraction and fallback to ConnectInfo - Harden HTML sanitizer: deny unknown URL schemes, restrict data URIs - Remove session token from login response body - Enforce image pixel/dimension limits on upload and serving P1 high-risk: - Validate uploads by magic bytes and decode GIF/WebP - Add pagination/rate-limiting to search, tag posts, and comments - Make first-admin registration and slug uniqueness check atomic - HTML-escape comment author fields - Improve HTML minify cache key and skip admin/error responses - Add mobile navigation menu P2 accessibility/quality: - Associate form labels with inputs - Key PostDetail article by slug to re-init scripts on navigation - Improve image viewer keyboard accessibility - Make theme toggle SSR-friendly and add aria-label - Invalidate slug 404 cache on create and pending count on new comment - Deduplicate tags case-insensitively P3 cleanup: - Remove unused tower-http dependency, expand make clean - Configure DB pool timeouts and verified recycling - Run background cleanup tasks immediately on startup - Use SHA-256 for stable disk cache keys - Log DB errors with Display instead of Debug - Update README migration instructions All tests pass (321), clippy clean, dx check clean.
10 lines
336 B
SQL
10 lines
336 B
SQL
-- 将 comments.post_id 外键从 RESTRICT 改为 CASCADE,
|
||
-- 使回收站清理/自动清理能够删除仍有评论的文章。
|
||
|
||
ALTER TABLE comments
|
||
DROP CONSTRAINT IF EXISTS comments_post_id_fkey;
|
||
|
||
ALTER TABLE comments
|
||
ADD CONSTRAINT comments_post_id_fkey
|
||
FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE;
|