Skip to main content

Module admin

Module admin 

Source
Expand description

Database lifecycle helpers: CREATE DATABASE / DROP DATABASE against a maintenance connection. Useful for test scaffolding and dev tooling where you don’t want a separate psql dependency.

Connects to the postgres maintenance database on the same host/port, so the target database doesn’t have to exist yet.

Functions§

create_database
Create database if it does not already exist. Returns true if a new database was created, false if it was already present.
drop_database
Drop database. With force, first terminates other sessions connected to the target so the DROP can proceed. Succeeds silently if the database does not exist.