function renameReservedCategories
renameReservedCategories(db: DatabaseSync): void

Renames each category whose slug is now reserved, such as hot, to the first of <slug>-2, <slug>-3… that is free, and logs it. Migration 0021 runs it for v4's words, 0022 for community, 0024 for authorize and federation, and 0025 for playlists.

It reads every category: until 0025 gave categories a kind, each was a dump category, and 0025 makes no other. A later migration that reserves more words must leave the playlist categories alone, and limit it to kind = 'dump', which the earlier ones can't, having no such column.

Parameters

db: DatabaseSync

Return Type

void

Usage

import { renameReservedCategories } from "api/lib/reserved-slugs.ts";