Makes usernames and emails unique regardless of case. Usernames were unique only as typed, so "Bob" and "bob" could both sign up, and a mention, which looks names up in lower case, then reached one of them at random. Emails had no constraint at all: two sign-ups racing past the service's check could share an address, and password resets are looked up by address.

Functions

f
up(db: DatabaseSync): void

Run once by runMigrations. It refuses to run, naming the clashes, when two accounts already share a name or an address in some case: which one keeps it is for whoever runs the site to decide, by editing one of them.

Usage

import * as mod from "api/db/migrations/0017_case_insensitive_users.ts";