Lets the create form warn that a link was already dumped. It adds dumps.url_canonical, the key the hint looks a URL up by, and fills it for every URL dump already posted.

It fills the key from each stored URL and fetches nothing. Its helpers are a copy of lib/canonical-url.ts as it stood when this shipped: importing the live one would give two databases migrated at different times keys made by different rules. A change to lib/canonical-url.ts therefore needs a new migration that fills the keys again.

Functions

f
up(db: DatabaseSync): void

Run once by runMigrations. It fills only the keys still NULL, and leaves NULL a URL that isn't http(s).

Usage

import * as mod from "api/db/migrations/0013_dump_url_canonical.ts";