Files
novaconium/novaconium/migrations/0001_create_content_index.sql
T
codeandClaude Opus 4.8 d1ce803412 Fix review findings; consolidate pre-release migrations
Bug fixes:
- Deleting a user with comments no longer 500s: remove the user's
  comments first (covers old DBs) and add ON DELETE CASCADE to the FK.
- Drop 'svg' from the default media upload allowlist (stored-XSS vector
  for files served directly from public/uploads/).
- Content index now reindexes on page deletion: track routable page
  count in content_index_meta and treat a count change as stale, since
  the newest-mtime check alone can't see a removal.
- Dev router (public/router.php) preserves the query string across the
  canonical trailing-slash redirect, matching .htaccess.
- Fix stale worked-example reference in the comments thread partial.

Migrations: since v2 is unreleased with no live databases, fold the
incremental ALTERs into the base migrations rather than shipping them
separately: verification columns into 0002_create_users.sql, source_count
into 0001_create_content_index.sql; renumber comments to 0003. Update all
code/doc references to the removed/renamed files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 05:30:10 +00:00

27 lines
781 B
SQL

CREATE TABLE IF NOT EXISTS content_pages (
route TEXT PRIMARY KEY,
title TEXT NOT NULL,
description TEXT NOT NULL,
keywords TEXT NOT NULL DEFAULT '',
changefreq TEXT NOT NULL DEFAULT '',
priority TEXT NOT NULL DEFAULT '',
source_mtime INTEGER NOT NULL
);
CREATE TABLE IF NOT EXISTS content_tags (
route TEXT NOT NULL,
tag TEXT NOT NULL,
PRIMARY KEY (route, tag)
);
CREATE INDEX IF NOT EXISTS idx_content_tags_tag ON content_tags(tag);
CREATE VIRTUAL TABLE IF NOT EXISTS content_search USING fts5(route UNINDEXED, title, body);
CREATE TABLE IF NOT EXISTS content_index_meta (
id INTEGER PRIMARY KEY CHECK (id = 1),
newest_source_mtime INTEGER NOT NULL,
source_count INTEGER NOT NULL DEFAULT 0,
indexed_at TEXT NOT NULL
);