Let an app ask for PostgreSQL extensions its user can't make

coreapp.toml's [postgres] extensions = ["vector"]: the installer checks
the Core's PostgreSQL has each one (refusing before anything changes if
not) and makes them in the app's database as the superuser, with CASCADE,
on install and every update. Ones taken off the list are kept, since the
data may use them. Also fixes the check refusing needs with both postgres
and mysql, which never ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 20:28:33 -07:00
co-authored by Claude Opus 5.5
parent a7cd4e325c
commit cf18bef278
9 changed files with 113 additions and 8 deletions
+11
View File
@@ -222,6 +222,17 @@ The Core's own scripts trace secrets, so their output goes to
disk (btrfs) and what's not offered. As an app's database user,
`CREATE EXTENSION pg_trgm` works and `CREATE EXTENSION vector` is
refused ("Must be superuser").
5c. `[postgres] extensions`: a `coreapp new --postgres` app with
`[postgres]` `extensions = ["vector"]` deploys with "Enabling PostgreSQL
extension(s) vector"; on the Core, its database has vector (owned by
postgres), and as the app's user a `vector(3)` table, a distance query
and an HNSW index work. Adding `"postgis"` is refused before anything
changes ("this Core's PostgreSQL doesn't have postgis"); adding
`"pg_trgm"` enables only that; `"earthdistance"` brings cube with it.
An update that fails (a wrong `port`) rolls back with the extensions,
the table and its index. `[postgres]` without `"postgres"` in needs, an
unknown setting or a bad name is refused; so is `needs` with both
postgres and mysql.
6. `coreapp status` (address and port), `coreapp logs`, `coreapp shell`
(exit with `exit`), `coreapp shell 'id; echo $APP_URL'` (prints both,
no terminal needed, also when piped), `coreapp list` (all apps installed