(deps: Pick<PostgresProgramDeps, "createdb">, database_url: string, options?: CreateDatabaseOptions | undefined): Promise<...> import {create_database} from '@fuzdev/fuz_app/dev/setup.js'; Create the PostgreSQL database database_url names, on the server it
names, when it's missing.
Runs createdb --no-password --maintenance-db=<maintenance URL> -- <name>
(to_createdb_args) through the program deps.createdb makes, with the
URL's password in its environment (see PostgresProgramDeps). A URL that
isn't Postgres (file://, memory://) has nothing to create and is
skipped, as is a missing createdb. Does not throw on a failed createdb —
the result says what happened, and the log says why; a createdb that
can't start throws.
On a server whose lc_messages isn't English, an existing database is
reported as failed, since only Postgres's English refusal is recognized.
A capped (truncated) output is read as it came: a clean exit is still
success, and a cut stderr is still searched for the refusal.
deps
the createdb factory
Pick<PostgresProgramDeps, "createdb">database_url
the DATABASE_URL value
stringoptions?
logger
returns
Promise<CreateDatabaseResult>
what happened
mutates
external database— creates the database on the server `database_url` names