Moves the site to v4's page URLs, where dumps and playlists live under their owner (/@bob/dumps/<slug>) and are named by an editable slug alone. A slug was slugify(title)-<8 hex of the id>, unique site-wide; it is now the bare slugify(title), unique in its owner's space for its kind, and every slug an item or a user leaves behind stays an alias that redirects (dump_slug_aliases, playlist_slug_aliases, user_aliases).

v3 URLs aren't redirected. Instead this rewrites the links to this site's pages in what users wrote: dump notes, comments, chat messages, and playlist and profile descriptions.

SQLite can't make slug NOT NULL without rebuilding dumps and playlists, which other tables reference, so the column stays nullable and every writer sets it; the unique index is what the services rely on.

Functions

f
up(db: DatabaseSync): void

Run once by runMigrations. On a database made from schema.sql the tables and indexes exist and there is nothing to re-slug or rewrite.

Usage

import * as mod from "api/db/migrations/0021_page_urls.ts";