Skip to main content

PostgreSQL migrations, sweetly done ๐Ÿ“

Project description

Confiture ๐Ÿ“

PostgreSQL migrations, sweetly done

Confiture is the official migration tool for FraiseQL, designed with a build-from-scratch philosophy and 4 migration strategies to handle every scenario from local development to zero-downtime production deployments.

Part of the FraiseQL ecosystem - While Confiture works standalone for any PostgreSQL project, it's designed to integrate seamlessly with FraiseQL's GraphQL-first approach.

License: MIT Python 3.11+ PostgreSQL 12+ CI Code style: ruff Type checked: mypy Made with Rust Part of FraiseQL Status: Stable


Why Confiture?

Traditional migration tools (Alembic, Django migrations) replay migration history to build databases. This is slow and brittle.

Confiture treats DDL source files as the single source of truth:

  • โœ… Fresh databases in <1 second (not minutes)
  • โœ… 4 migration strategies (simple ALTER to zero-downtime FDW)
  • โœ… Production data sync built-in (with PII anonymization)
  • โœ… Python + Rust performance (10-50x faster than pure Python)
  • โœ… Perfect with FraiseQL, useful for everyone

The Four Mediums

1๏ธโƒฃ Build from DDL

confiture build --env production

Build fresh database from db/schema/ DDL files in <1 second.

2๏ธโƒฃ Incremental Migrations (ALTER)

confiture migrate up

Apply migrations to existing database (simple schema changes).

3๏ธโƒฃ Production Data Sync

confiture sync --from production --anonymize users.email

Copy production data to local/staging with PII anonymization.

4๏ธโƒฃ Schema-to-Schema Migration (Zero-Downtime)

confiture migrate schema-to-schema --strategy fdw

Complex migrations via FDW with 0-5 second downtime.


Quick Start

Installation

pip install fraiseql-confiture

# Or with FraiseQL integration
pip install fraiseql-confiture[fraiseql]

Initialize Project

confiture init

Creates:

db/
โ”œโ”€โ”€ schema/           # DDL: CREATE TABLE, views, functions
โ”‚   โ”œโ”€โ”€ 00_common/
โ”‚   โ”œโ”€โ”€ 10_tables/
โ”‚   โ””โ”€โ”€ 20_views/
โ”œโ”€โ”€ seeds/            # INSERT: Environment-specific test data
โ”‚   โ”œโ”€โ”€ common/
โ”‚   โ”œโ”€โ”€ development/
โ”‚   โ””โ”€โ”€ test/
โ”œโ”€โ”€ migrations/       # Generated migration files
โ””โ”€โ”€ environments/     # Environment configurations
    โ”œโ”€โ”€ local.yaml
    โ”œโ”€โ”€ test.yaml
    โ””โ”€โ”€ production.yaml

Build Schema

# Build local database
confiture build --env local

# Build production schema
confiture build --env production

Create Migration

# Edit schema
vim db/schema/10_tables/users.sql

# Generate migration
confiture migrate generate --name "add_user_bio"

# Apply migration
confiture migrate up

Documentation

๐Ÿ“– User Guides

๐Ÿ“š API Reference

๐Ÿ’ก Examples


Features

โœ… Complete (Phases 1-3)

Core Migration System:

  • โœ… Build from DDL (Medium 1) - Fresh databases in <1 second
  • โœ… Incremental migrations (Medium 2) - Simple ALTER-based changes
  • โœ… Production data sync (Medium 3) - Copy with PII anonymization
  • โœ… Zero-downtime migrations (Medium 4) - Schema-to-schema via FDW

Performance & Distribution:

  • โœ… Rust performance layer (10-50x speedup) ๐Ÿš€
  • โœ… Binary wheels for Linux, macOS, Windows
  • โœ… Parallel migration execution
  • โœ… Progress tracking with resumability

Developer Experience:

  • โœ… Environment-specific seed data (development/test/production)
  • โœ… Schema diff detection with auto-generation
  • โœ… CLI with rich terminal output and colors
  • โœ… Comprehensive documentation (5 guides, 4 API docs)
  • โœ… Production-ready examples (5 complete scenarios)

Integration & Safety:

  • โœ… FraiseQL GraphQL integration
  • โœ… Multi-environment configuration
  • โœ… Transaction safety with rollback support
  • โœ… PII anonymization with compliance tools
  • โœ… CI/CD pipeline examples (GitHub Actions)

๐Ÿšง Coming Soon (Phase 4)

  • Advanced migration hooks (before/after)
  • Custom anonymization strategies
  • Interactive migration wizard
  • Migration dry-run mode
  • Database schema linting

Comparison

Feature Alembic pgroll Confiture
Philosophy Migration replay Multi-version schema Build-from-DDL
Fresh DB setup Minutes Minutes <1 second
Zero-downtime โŒ No โœ… Yes โœ… Yes (FDW)
Production sync โŒ No โŒ No โœ… Built-in
Language Python Go Python + Rust

Development Status

Current Version: 0.3.0 (Production Release) ๐ŸŽ‰

Recent Updates (v0.3.0):

  • โœ… Hexadecimal file sorting for better schema organization
  • โœ… Enhanced dynamic SQL file discovery
  • โœ… Recursive directory support with improved performance

Milestone Progress:

  • โœ… Phase 1: Python MVP (Complete - Oct 2025)
  • โœ… Phase 2: Rust Performance Layer (Complete - Oct 2025)
  • โœ… Phase 3: Production Features (Complete - Oct 2025)
    • โœ… Zero-downtime migrations (FDW)
    • โœ… Production data sync with PII anonymization
    • โœ… Comprehensive documentation (5 guides, 4 API references)
    • โœ… Production examples (5 complete scenarios)
  • โœ… CI/CD & Release Pipeline (Complete - Nov 2025)
    • โœ… Multi-platform wheel building (Linux, macOS, Windows)
    • โœ… PyPI Trusted Publishing
    • โœ… Quality gate with comprehensive checks
    • โœ… Python 3.11, 3.12, 3.13 support verified
  • โœ… v0.3.0: Enhanced Schema Building (Complete - Nov 2025)
    • โœ… Hexadecimal file sorting (0x01_, 0x0A_, etc.)
    • โœ… Dynamic discovery with patterns and filtering
    • โœ… Recursive directory support
    • โœ… Advanced configuration options
    • โœ… Comprehensive feature documentation
  • โณ Phase 4: Advanced Features (Q1 2026)
    • Migration hooks, wizards, dry-run mode

Statistics:

  • ๐Ÿ“ฆ 4 migration strategies implemented
  • ๐Ÿ“– 5 comprehensive user guides + 3 feature guides
  • ๐Ÿ“š 4 API reference pages
  • ๐Ÿ’ก 5 production-ready examples
  • ๐Ÿงช 89% test coverage (258 tests) - 3 new test files added
  • โšก 10-50x performance with Rust
  • ๐Ÿš€ Production-ready CI/CD pipeline
  • ๐Ÿ”ง Advanced file discovery with hex sorting support

See PHASES.md for detailed roadmap.


Contributing

Contributions welcome! We'd love your help making Confiture even better.

Quick Start:

# Clone repository
git clone https://github.com/fraiseql/confiture.git
cd confiture

# Install dependencies (includes Rust build)
uv sync --all-extras

# Build Rust extension
uv run maturin develop

# Run tests
uv run pytest --cov=confiture

# Format code
uv run ruff format .

# Type checking
uv run mypy python/confiture/

Resources:

What to contribute:

  • ๐Ÿ› Bug fixes
  • โœจ New features
  • ๐Ÿ“– Documentation improvements
  • ๐Ÿ’ก New examples
  • ๐Ÿงช Test coverage improvements

Author

Vibe-engineered by Lionel Hamayon ๐Ÿ“

Confiture was crafted with care as the migration tool for the FraiseQL ecosystem, combining the elegance of Python with the performance of Rust, and the sweetness of strawberry jam.


License

MIT License - see LICENSE for details.

Copyright (c) 2025 Lionel Hamayon


Acknowledgments

  • Inspired by printoptim_backend's build-from-scratch approach
  • Built for FraiseQL GraphQL framework
  • Influenced by pgroll, Alembic, and Reshape
  • Developed with AI-assisted vibe engineering โœจ

FraiseQL Ecosystem

Confiture is part of the FraiseQL family:

  • FraiseQL - Modern GraphQL framework for Python
  • Confiture - PostgreSQL migration tool (you are here)

Making jam from strawberries, one migration at a time. ๐Ÿ“โ†’๐Ÿฏ

Vibe-engineered with โค๏ธ by Lionel Hamayon

Documentation โ€ข GitHub โ€ข PyPI

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.3.0.tar.gz (314.8 kB 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.3.0-cp314-cp314-win_amd64.whl (206.9 kB view details)

Uploaded CPython 3.14Windows x86-64

fraiseql_confiture-0.3.0-cp313-cp313-win_amd64.whl (206.9 kB view details)

Uploaded CPython 3.13Windows x86-64

fraiseql_confiture-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (257.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fraiseql_confiture-0.3.0-cp312-cp312-win_amd64.whl (207.0 kB view details)

Uploaded CPython 3.12Windows x86-64

fraiseql_confiture-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl (291.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

fraiseql_confiture-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (257.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fraiseql_confiture-0.3.0-cp311-cp311-win_amd64.whl (206.8 kB view details)

Uploaded CPython 3.11Windows x86-64

fraiseql_confiture-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl (293.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

fraiseql_confiture-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (257.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: fraiseql_confiture-0.3.0.tar.gz
  • Upload date:
  • Size: 314.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for fraiseql_confiture-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5193759227897e6f60d987c465bc43160bcb782a04440f97c3c3f3611f3c0428
MD5 63be4de2f5d53923fa356fe396b28b2a
BLAKE2b-256 62b627be82c5b66f86b9a71ed1d2c8acd80f5ac27d9ef939c6851c47a137bece

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ac0c1928d88ea3e8e7edd857e4f9f67088242c426f3bfcf6c4d40323ebfcae42
MD5 9856c2922fda603e9cc147e1b95a92c3
BLAKE2b-256 beb45bc8e0f853f2b6b91bbd1560e8584fb4914b44625d106a45b9a9df496c4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9dbb5e2ac4bda3ae4f59fcbbac54c0b1fba8e9428a3ed154f9272d4e513e782c
MD5 f98af3d3c1a0e497c5d7204f39345c43
BLAKE2b-256 0c5e753120b074313463df703ff4cd2392df7a261fe32e3875006fc2bc055b6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43a5438e9704f878afd6e997a61858ffdfb79a67c855ec4a2ce5935bb8fd2cc6
MD5 19a0ee98974a1548b81b499717a4cdce
BLAKE2b-256 f2ca98ba507f8fbcea8da2e9db18cd5d00fa835e64d38e3d5a40114368043bad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bcdbe78e6f6ca3f0dfff21c0118cb4ac972b6ade7fecde2b67ae7b4cb75edbfa
MD5 ec435b4f058f44caecf2768126cdab58
BLAKE2b-256 5b091faee496897e4ae55b11dc03d8b1f80daf2e11cc82a04c3d10e74519efb0

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 974452ffcc2d47126d2b72530cce7dd9a0e9c69157b4a2d0bb675e3ba0a2c493
MD5 c9c4be5a9fea2fa630c82191d11aa309
BLAKE2b-256 3d62d854399dc862dd423e0d89a38d33f6d812b58895e1f858fe4f1f45bdbd16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cae132db0da7235a5cc2629a7a3558cef2a616f716059247d95ecf83b63ed019
MD5 75957b2fda4b8586c6b016a59094d234
BLAKE2b-256 48de002d71484eae8917697b197f0411690ecace79d99f01393fdfddc7aaef5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a001e8b317322bb3af53d284682576eb5c6b3624e6e4fed0d56161de6662aa59
MD5 ba678c0956cbcf63699dfb742df9882f
BLAKE2b-256 077f0482fe0cb0b8bebdcc75c3af13bbef00bb85eb27b40c590d866e2cc181b0

See more details on using hashes here.

File details

Details for the file fraiseql_confiture-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1dec4ac51cb65e2b8130b769bc65b837d4be22d4fcc52e99511d7f14ee504da4
MD5 a6a309373a032ef8da2b74d9609dc885
BLAKE2b-256 e67442ce156d98457b10bd76d83ecd1273a5ec3ecfaee0e36867b5a11cc18c94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 665a39ccc14662b70df5ed4be57fa4cabfd26d770f0eab2172d7d942b475c81b
MD5 196303c5aa115d0ea8a37c40ffb806e5
BLAKE2b-256 93c56ad51a96407496855b6e8fe51d25456eb40a0f994377b1badb57894f036b

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