Skip to main content

PostgreSQL schema evolution with built-in multi-agent coordination 🍓

Project description

Confiture 🍓

PostgreSQL migrations, sweetly done.

Build from DDL. Adopt on day one against a database that already has migrations applied. Preflight every deploy against a parallel database with structural diff. Sync production data with PII anonymization.

PyPI Quality Gate Python 3.11+ PostgreSQL 12+ License: MIT


In 30 seconds

# 1. You already have a database at migration 004 (applied by hand or by another tool).
#    Tell Confiture about that history without re-running the SQL:
$ confiture migrate baseline --through 004 -c db/environments/production.yaml
   001 create_users (marked as applied)
   002 create_orders (marked as applied)
   003 add_user_email (marked as applied)
   004 add_user_preferences (marked as applied) Marked 4 migration(s) as applied, skipped 0 already applied

# 2. Machine-readable proof that the tracking is healthy:
$ confiture migrate status -c db/environments/production.yaml --format json | jq '.applied | length'
4

# 3. Preflight the next deploy end-to-end against a parallel database:
$ confiture migrate preflight --against "$PREFLIGHT_URL" -c db/environments/production.yaml
▸ Replaying pending migrations on preflight DB    20260520143015_add_user_bio                 applied in 24 ms
▸ Comparing resulting schema vs. db/schema/    No drift  preflight matches db/schema/
✓ Preflight passed. Safe to deploy.
exit 0

That's the loop. Baseline once → status to confirm → preflight every deploy.


Already have migrations?

The single biggest reason migration tools fail adoption is the day-one cliff: existing tables already exist, so any tool that tries to apply migrations from scratch crashes on the first CREATE TABLE. Confiture's answer is migrate baseline:

confiture migrate baseline --through <last-applied-version>

The walkthrough — including failure modes, the integration test that backs the recipe, and what tb_confiture ends up looking like — is in docs/guides/legacy-bootstrap.md.


When to use Confiture?

Capability Confiture Flyway Alembic dbmate sqlx-cli plain psql
Source of truth DDL files migration chain model classes migration chain migration chain DDL files
Tracking table yes yes yes yes yes no
Rollback (down.sql) yes paid yes yes yes no
Preflight against a copy DB yes (structural diff) no no no no no
Build from scratch in <1s yes no no no no yes (manual)
Production sync + anonymization yes no no no no no
Zero-downtime via FDW yes no no no no no
Multi-agent coordination yes no no no no no
Ecosystem maturity / stars early very mature mature mature mature n/a

Confiture wins on build-from-DDL, structural-diff preflight, production sync, and multi-agent coordination. It loses on ecosystem age — Flyway and Alembic have a decade of community knowledge. Pick honestly.

Adoption checklist

Situation Recommended tool
1 environment + 1 contributor, schema rarely changes plain psql
2+ environments, schema changes weekly Confiture, Flyway, Alembic, or dbmate
Multi-agent / AI-driven development on shared schemas Confiture
You want db/schema/ to be source of truth, not a migration chain Confiture
You need zero-downtime schema swaps with postgres_fdw Confiture (Medium 4)
You're committed to SQLAlchemy ORM Alembic
You're committed to a JVM stack Flyway

CI integration

A migrate preflight gate on every PR, a migrate up step on deploy. Exit codes are semantic, so the CI configuration stays simple:

# .github/workflows/db.yml
name: DB

on:
  pull_request:
    paths:
      - 'db/**'
  push:
    branches: [main]

jobs:
  preflight:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:16
        env: { POSTGRES_PASSWORD: x }
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready --health-interval 10s
          --health-timeout 5s --health-retries 5
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v3
      - run: uv pip install --system "fraiseql-confiture[ast]"
      - name: Restore production snapshot to preflight DB
        run: ./scripts/restore-snapshot.sh   # your own; pg_restore from S3/GCS
      - name: Confiture preflight
        env:
          PREFLIGHT_URL: postgresql://postgres:x@localhost:5432/preflight
        run: |
          confiture migrate preflight \
            --against "$PREFLIGHT_URL" \
            -c db/environments/preflight.yaml \
            --format json --output preflight.json
      - uses: actions/upload-artifact@v4
        with:
          name: preflight-report
          path: preflight.json

  deploy:
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v4
      - uses: astral-sh/setup-uv@v3
      - run: uv pip install --system "fraiseql-confiture[ast]"
      - run: confiture migrate up -c db/environments/production.yaml
        env:
          DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}

Exit codes: 0 success, 2 config error, 3 SQL failure, 6 lock contention, 7 structural drift. See the dry-run guide for what each one means.


Python project snippet

Add Confiture as a dev dependency. The [ast] extra pulls in pglast for full PostgreSQL parsing — recommended for schemas with bulk seed data.

# pyproject.toml
[dependency-groups]
dev = [
  "fraiseql-confiture[ast]>=0.9",
  "pytest>=8",
]
# justfile
default:
    just --list

db-build:
    confiture build --env local

db-up:
    confiture migrate up

db-status:
    confiture migrate status

db-preflight:
    confiture migrate preflight --against "$PREFLIGHT_URL"

Or as a Makefile:

db-build:
	confiture build --env local

db-up:
	confiture migrate up

db-status:
	confiture migrate status

Library API

Confiture is a CLI first, but the migrator is fully usable from Python:

from confiture import Migrator

with Migrator.from_config("db/environments/prod.yaml") as m:
    status = m.status()
    if status.has_pending:
        result = m.up()
        print(f"Applied {len(result.applied)} migrations")

The Four Strategies

Strategy Use Case Command
Build from DDL Fresh databases, testing, CI confiture build --env local
Incremental Migrations Existing databases, production confiture migrate up
Production Sync Copy data with PII anonymization confiture sync --from prod --anonymize users.email
Zero-Downtime Complex migrations via FDW confiture migrate schema-to-schema

Documentation

Start here

Guides

Reference


Contributing

git clone https://github.com/fraiseql/confiture.git
cd confiture
uv sync --all-extras
uv run pytest

See CONTRIBUTING.md and CLAUDE.md.


Author & License

Vibe-engineered by Lionel Hamayon 🍓

MIT License — Copyright (c) 2025 Lionel Hamayon


Making jam from strawberries, one migration at a time. 🍓→🍯

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fraiseql_confiture-0.12.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fraiseql_confiture-0.12.0-cp314-cp314-win_amd64.whl (842.7 kB view details)

Uploaded CPython 3.14Windows x86-64

fraiseql_confiture-0.12.0-cp313-cp313-win_amd64.whl (842.7 kB view details)

Uploaded CPython 3.13Windows x86-64

fraiseql_confiture-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl (935.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

fraiseql_confiture-0.12.0-cp313-cp313-macosx_11_0_arm64.whl (889.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fraiseql_confiture-0.12.0-cp312-cp312-win_amd64.whl (842.8 kB view details)

Uploaded CPython 3.12Windows x86-64

fraiseql_confiture-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl (935.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

fraiseql_confiture-0.12.0-cp312-cp312-macosx_11_0_arm64.whl (889.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fraiseql_confiture-0.12.0-cp311-cp311-win_amd64.whl (842.6 kB view details)

Uploaded CPython 3.11Windows x86-64

fraiseql_confiture-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl (936.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

fraiseql_confiture-0.12.0-cp311-cp311-macosx_11_0_arm64.whl (889.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file fraiseql_confiture-0.12.0.tar.gz.

File metadata

  • Download URL: fraiseql_confiture-0.12.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0.tar.gz
Algorithm Hash digest
SHA256 c425d47242e0d2c367275ee38272ee5dad8ff05d33d3ce88c2eb6df4e18a51b4
MD5 ef13ab68d9410b85dc89fcd47338eb2e
BLAKE2b-256 c8f9c6b5ee34bf0dbe422a64d265e195dba6252cc7515765d68e8a35250d434c

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 842.7 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 0b297a58716997a5df9cfa8ce69d75bb7e491e7be1ba9c171e0bb778212e023b
MD5 d6f0479dfb76ae03ef4c08f2efa1792b
BLAKE2b-256 1a64e70b620b354ef6980454ba12b40ab5b6aa9b6d41a8f77c994fb19da51384

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 842.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fd95205a12ae679c869281f5c8e04c1d8e7a0b48cd3d468ea7422bad1f3d71b1
MD5 5caf074fd6b58543ac55c6128390ca84
BLAKE2b-256 8e10cd2feadd3ba1caf35a2168e7504aa486d9d476a983eba9f91108bc195fca

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 935.3 kB
  • Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ca0b9cc2aebd58605b5feb9a2f3dd9ff68b579d1e383583804bb3496bf7683c
MD5 81b3d0d49142c48b6b2bb23205cdf791
BLAKE2b-256 02aabba98627b7efe8da4e94ce858c4eb2491f3012786439c3efdd1e77294031

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 889.7 kB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e9bf70dbaf5359a58e0f37d489c1cece03ff9654f3e5e6290ae26892e9f1809
MD5 12a9dc5c81d6ea30cdbca5c5d2434389
BLAKE2b-256 fb1e18a3b42b63ffddc138ad5799c971367ec691aadecade9ebcd54ef5486616

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 842.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 01da7ea64f6bee3c9d0e8308766ec4f877dc921a35a693338422c8cd0e64fc48
MD5 a7d45bebf09cac8f79b4ddd371aae152
BLAKE2b-256 e707465bdf2b94303792e5d57e76b528590aed6a5a905a3be8f88a3c714918b4

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 935.4 kB
  • Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 909f88cb19fd7bfff80eabcbfbc5613ba3e1b2094474a94d49be133d6636aec3
MD5 c64ba82a4cf662d41ae8b7241854de9e
BLAKE2b-256 21ebe7a0ef1fa1691fc62aaa17026d9b0cc8ef8778d7eb10ec73d7edeea9bbc4

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp312-cp312-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 889.6 kB
  • Tags: CPython 3.12, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98c5b040d4f586fb5cf6b03c8150cb6b1f2af7ce3041afcf8405e0ccfedc9e2c
MD5 db35a6d9e4a26fcf35985108414ae3f9
BLAKE2b-256 80fd9d9d3b9c161bd9cd205727b0e8772766d309ebc3a84ca9118a0d7ef03f3f

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 842.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 02882d71b446b9f02b930a46a3afcccd2c220ad7c2683f390e1a9466d6d0f40e
MD5 d82950c3a5670391d1e4122969c85147
BLAKE2b-256 b5451c64ace6defd8a1263f423a5201be63ef31569cc343d276e055e52707709

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 936.8 kB
  • Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a6588e1828ebeecefa5f60c5873a149bb214661e707b57694e3ac9340062b467
MD5 8b69afbeb4bae185e1d9d076dafb39a5
BLAKE2b-256 bfa61a5a62dd30fde1db30dd80240bbb0713257f0bf2e7f2bd713ef3901b09aa

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.12.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fraiseql_confiture-0.12.0-cp311-cp311-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 889.9 kB
  • Tags: CPython 3.11, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fraiseql_confiture-0.12.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2956aade988d006b53b433e6045d4708e83b18f1016bab00505f6ff2b48a3e30
MD5 2a15d16e30943a35bf6a05ea07dc9acc
BLAKE2b-256 0414a1afdddd05420f3cb0443fb6c6db98925e3846b2b23c819b419b899138ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page