testing/cross_backend/postgres_database.ts view source
(database_url: string, options: EmptyOwnedDatabaseOptions): Promise<void> import {empty_owned_database} from '@fuzdev/fuz_app/testing/cross_backend/postgres_database.js'; Drop and recreate the public schema of a database a setup owns, so a
backend that does not wipe its own database migrates and bootstraps from
nothing on every run — bootstrap refuses a database that already holds an
account.
The wipe takes everything, so it is tied to owned_name, the one database
the setup owns, rather than to whatever URL reaches it. Create the database
first (ensure_database_for_url); a missing one, a server that cannot be
reached and a role that cannot connect all fail with what to check.
database_url
a postgres:// URL naming the owned database
stringoptions
the owned name, the setup's label, and an optional hint
returns
Promise<void>
throws
Error- when the URL names another database, or when the database cannot be emptied (with what to check)