Metadata-Version: 2.4
Name: dbwarden-pgsql-extensions
Version: 0.1.0
Summary: DBWarden PostgreSQL extensions object plugin proof.
Requires-Python: >=3.12.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dbwarden>=0.15.0
Dynamic: license-file

# dbwarden-pgsql-extensions

PostgreSQL extension management for [DBWarden](https://github.com/dbwarden/dbwarden).

`dbwarden-pgsql-extensions` is an official DBWarden plugin. It is discovered automatically through its `dbwarden.plugins` entry point and loaded without a consent prompt once installed.

## What It Provides

An object handler for the `pg_extension` object type. It participates in DBWarden's schema diff pipeline (extract, canonicalize, diff, emit) so that PostgreSQL extensions declared in your configuration are converged with the database. The handler runs in the preamble, before tables, using public ordering anchors (`after=PREAMBLE`, `before=BEFORE_TABLES`).

It emits idempotent DDL:

```sql
CREATE EXTENSION IF NOT EXISTS "btree_gist";
-- rollback:
DROP EXTENSION IF EXISTS "btree_gist";
```

## Install

```bash
dbwarden plugin add dbwarden-pgsql-extensions
```

`plugin add` verifies the package provenance (a PyPI PEP 740 attestation from the official repository) before installing. You can also install it directly:

```bash
uv add dbwarden-pgsql-extensions
# or
pip install dbwarden-pgsql-extensions
```

PostgreSQL only.

## Use

Declare the extensions your schema needs in your DBWarden configuration (`pg_extensions`). With the plugin loaded, `dbwarden make-migrations` diffs the declared extensions against the live database and emits the `CREATE EXTENSION` / `DROP EXTENSION` statements in the correct order. Confirm the plugin is loaded:

```bash
dbwarden plugin list
```

## Development

```bash
pip install -e . pytest
pytest -q
```

See the [object-plugin docs](https://github.com/dbwarden/dbwarden/blob/main/docs/plugins/developing/object-plugins.md).

## License

MIT
