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.
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
- Medium 1: Build from DDL - Fresh databases in <1 second
- Medium 2: Incremental Migrations - ALTER-based changes
- Medium 3: Production Data Sync - Copy and anonymize data
- Medium 4: Zero-Downtime Migrations - Schema-to-schema via FDW
- Migration Decision Tree - Choose the right strategy
๐ API Reference
- CLI Reference - All commands documented
- Configuration Reference - Environment configuration
- Schema Builder API - Building schemas programmatically
- Migrator API - Migration execution
- Syncer API - Production data sync
- Schema-to-Schema API - Zero-downtime migrations
๐ก Examples
- Examples Overview - 5 complete production examples
- Basic Migration - Learn the fundamentals (15 min)
- FraiseQL Integration - GraphQL workflow (20 min)
- Zero-Downtime - Production deployment (30 min)
- Production Sync - PII anonymization (25 min)
- Multi-Environment Workflow - Complete CI/CD (30 min)
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:
- CONTRIBUTING.md - Contributing guidelines
- CLAUDE.md - AI-assisted development guide
- PHASES.md - Detailed roadmap
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:
Making jam from strawberries, one migration at a time. ๐โ๐ฏ
Vibe-engineered with โค๏ธ by Lionel Hamayon
Documentation โข GitHub โข PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5193759227897e6f60d987c465bc43160bcb782a04440f97c3c3f3611f3c0428
|
|
| MD5 |
63be4de2f5d53923fa356fe396b28b2a
|
|
| BLAKE2b-256 |
62b627be82c5b66f86b9a71ed1d2c8acd80f5ac27d9ef939c6851c47a137bece
|
File details
Details for the file fraiseql_confiture-0.3.0-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 206.9 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac0c1928d88ea3e8e7edd857e4f9f67088242c426f3bfcf6c4d40323ebfcae42
|
|
| MD5 |
9856c2922fda603e9cc147e1b95a92c3
|
|
| BLAKE2b-256 |
beb45bc8e0f853f2b6b91bbd1560e8584fb4914b44625d106a45b9a9df496c4d
|
File details
Details for the file fraiseql_confiture-0.3.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 206.9 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dbb5e2ac4bda3ae4f59fcbbac54c0b1fba8e9428a3ed154f9272d4e513e782c
|
|
| MD5 |
f98af3d3c1a0e497c5d7204f39345c43
|
|
| BLAKE2b-256 |
0c5e753120b074313463df703ff4cd2392df7a261fe32e3875006fc2bc055b6b
|
File details
Details for the file fraiseql_confiture-0.3.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 257.2 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43a5438e9704f878afd6e997a61858ffdfb79a67c855ec4a2ce5935bb8fd2cc6
|
|
| MD5 |
19a0ee98974a1548b81b499717a4cdce
|
|
| BLAKE2b-256 |
f2ca98ba507f8fbcea8da2e9db18cd5d00fa835e64d38e3d5a40114368043bad
|
File details
Details for the file fraiseql_confiture-0.3.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 207.0 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcdbe78e6f6ca3f0dfff21c0118cb4ac972b6ade7fecde2b67ae7b4cb75edbfa
|
|
| MD5 |
ec435b4f058f44caecf2768126cdab58
|
|
| BLAKE2b-256 |
5b091faee496897e4ae55b11dc03d8b1f80daf2e11cc82a04c3d10e74519efb0
|
File details
Details for the file fraiseql_confiture-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 291.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
974452ffcc2d47126d2b72530cce7dd9a0e9c69157b4a2d0bb675e3ba0a2c493
|
|
| MD5 |
c9c4be5a9fea2fa630c82191d11aa309
|
|
| BLAKE2b-256 |
3d62d854399dc862dd423e0d89a38d33f6d812b58895e1f858fe4f1f45bdbd16
|
File details
Details for the file fraiseql_confiture-0.3.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 257.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cae132db0da7235a5cc2629a7a3558cef2a616f716059247d95ecf83b63ed019
|
|
| MD5 |
75957b2fda4b8586c6b016a59094d234
|
|
| BLAKE2b-256 |
48de002d71484eae8917697b197f0411690ecace79d99f01393fdfddc7aaef5a
|
File details
Details for the file fraiseql_confiture-0.3.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 206.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a001e8b317322bb3af53d284682576eb5c6b3624e6e4fed0d56161de6662aa59
|
|
| MD5 |
ba678c0956cbcf63699dfb742df9882f
|
|
| BLAKE2b-256 |
077f0482fe0cb0b8bebdcc75c3af13bbef00bb85eb27b40c590d866e2cc181b0
|
File details
Details for the file fraiseql_confiture-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 293.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dec4ac51cb65e2b8130b769bc65b837d4be22d4fcc52e99511d7f14ee504da4
|
|
| MD5 |
a6a309373a032ef8da2b74d9609dc885
|
|
| BLAKE2b-256 |
e67442ce156d98457b10bd76d83ecd1273a5ec3ecfaee0e36867b5a11cc18c94
|
File details
Details for the file fraiseql_confiture-0.3.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: fraiseql_confiture-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 257.5 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
665a39ccc14662b70df5ed4be57fa4cabfd26d770f0eab2172d7d942b475c81b
|
|
| MD5 |
196303c5aa115d0ea8a37c40ffb806e5
|
|
| BLAKE2b-256 |
93c56ad51a96407496855b6e8fe51d25456eb40a0f994377b1badb57894f036b
|