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: Beta


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.1.0 (Initial PyPI Release) ๐ŸŽ‰

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)
  • โณ Phase 4: Advanced Features (Q1 2026)
    • Migration hooks, wizards, dry-run mode

Statistics:

  • ๐Ÿ“ฆ 4 migration strategies implemented
  • ๐Ÿ“– 5 comprehensive user guides
  • ๐Ÿ“š 4 API reference pages
  • ๐Ÿ’ก 5 production-ready examples
  • ๐Ÿงช 95% test coverage
  • โšก 10-50x performance with Rust

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.1.0.tar.gz (288.3 kB view details)

Uploaded Source

Built Distribution

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

fraiseql_confiture-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (288.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

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

File metadata

  • Download URL: fraiseql_confiture-0.1.0.tar.gz
  • Upload date:
  • Size: 288.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for fraiseql_confiture-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d24c4d31994162895850502bd0872f737ac43c52fa6ee0ddba9aaaf482af3b8
MD5 cc5496f8fa86e8faf0ce47545f1025bc
BLAKE2b-256 5a00dec9985745333a2398211bb6db1adbb74a990a2e67427f07e0ac8cea2c87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fraiseql_confiture-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 19139b92cd4af7d5b649b6d340d3c52c45b8dab78f1885cfcecfc8fea538aac6
MD5 c79501351e6e4c705f0a86f0fde5d2c1
BLAKE2b-256 6ccea33df22c7e3d8ddace507e6500aa30267616a6eb6aa1bb001bbc7f088309

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