Docs/Engines/PostgreSQL

PostgreSQL

PostgreSQL runs DDL inside a transaction, so a migration that fails rolls back whole. It is the reference engine: the compatible family inherits this provider and declares only its differences.

type
postgresql
Driver
psycopg
DDL
Transactional
Identifiers
Lower-cased unless quoted

Install

pip install "dblift[postgresql]"

Connection URL

postgresql+psycopg://user:password@localhost:5432/app

A plain postgresql:// or postgres:// URL is accepted and normalised to postgresql+psycopg. Without a URL, DBLift builds one from host, port, database, username and password.

dblift.yaml

database:
  type: postgresql
  url: "postgresql+psycopg://db.internal:5432/app"
  schema: "public"
  connection_timeout: 30

Engine settings

KeyDefaultEffect
schemapublicApplied through search_path.
ssl_mode—Passed to the driver as sslmode.
connection_timeout30Connect timeout in seconds.

Behaviour notes

DDL is transactional.

A migration that fails rolls back whole.

Generated drops do not use CASCADE.

A generated DROP TABLE or DROP FUNCTION no longer appends CASCADE. A dependent object that is not in the script blocks the drop.