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
+17 -2
View File
@@ -118,7 +118,7 @@ using it runs, so deploy, `coreapp check` and a sign-in can all pass.
|---|---|---|
| PostgreSQL | 17.6 | `needs = ["postgres"]` |
| PostgreSQL extensions the app can enable (`CREATE EXTENSION` in its migrations) | btree_gin, btree_gist, citext, cube, fuzzystrmatch, hstore, intarray, isn, lo, ltree, pg_trgm, pgcrypto, seg, tablefunc, unaccent, uuid-ossp, ... | |
| Extensions only the Core can enable | vector (pgvector 0.8.1), pg_stat_statements, dblink, postgres_fdw, ... | not available to apps yet: report it |
| Extensions only the Core can enable | vector (pgvector 0.8.1), pg_stat_statements, dblink, postgres_fdw, ... | `[postgres] extensions = ["vector"]` in coreapp.toml |
| MariaDB | 12.1.2 | `needs = ["mysql"]` |
| Authelia | 4.39 | `needs = ["sso"]`: OpenID Connect sign-in with Core accounts |
| Mail server | docker-mailserver 16 | `needs = ["email"]`: sending, SMTP with STARTTLS |
@@ -160,7 +160,22 @@ The server is the Core's PostgreSQL (its version and extensions: "What the
Core offers"; check the app's needs against them first), shared with the
Core's other apps; the app owns its database and nothing else. There's no
superuser access, so the app creates its own tables (migrations at startup
are the usual way). At boot the
are the usual way). Extensions the app's user can't make (vector and the
others "only the Core can enable") go in `coreapp.toml`; the installer
makes them, as the superuser, before the app starts:
```toml
[postgres]
extensions = ["vector"] # pgvector, for the app's embeddings
```
List only those the app's migrations need (trusted ones may be listed
too, which is harmless; dependencies, like cube for earthdistance, come
with them). A migration's own `CREATE EXTENSION IF NOT EXISTS vector` then
passes; one without `IF NOT EXISTS` fails, so change it. An extension the
Core doesn't have (postgis today) is refused at deploy: report it. Taking
one off the list keeps it in the database, since the data may use it. At
boot the
database may come up after the app: retry the connection instead of
exiting. Many apps want a URL; build it from these variables in the
entrypoint or the app's config (e.g.