Skip to content

Confiture

FraiseQL is database-first — you write SQL tables and views, and FraiseQL maps them to GraphQL. But who manages the database itself? You confiture it.

confiture /kɔ̃.fi.tyʁ/ — French for jam, preserve. Sounds like configure. That’s the point.

Confiture is a database schema evolution framework that provides four strategies (“Mediums”) for every database lifecycle scenario. It treats your DDL files as the single source of truth, not migration history. You don’t configure your database — you confiture it.

MediumWhat It DoesWhen to Use
BuildCreates a fresh database from DDL files in under 1sDevelopment, CI/CD, testing
MigrateApplies incremental ALTER statementsProduction schema changes
SyncCopies production data with anonymizationRealistic local development
Schema-to-SchemaZero-downtime migration via FDWMajor production refactoring

The typical development cycle:

Terminal window
# 1. Write your SQL (tables in 01_write/, views in 02_read/)
vim db/schema/01_write/tb_order.sql
vim db/schema/02_read/v_order.sql
# 2. Build fresh database
confiture build --env local
# 3. Define GraphQL types
vim schema.py
# 4. Compile the mapping
fraiseql compile
# 5. Serve
fraiseql run

For existing databases:

Terminal window
# 1. Update SQL files
vim db/schema/01_write/tb_user.sql # Add new column
# 2. Create migration for existing data
confiture migrate generate add_avatar_url
# 3. Apply migration
confiture migrate up --env local
# 4. Update view to include new field
vim db/schema/02_read/v_user.sql
# 5. Rebuild views (or apply view migration)
confiture build --env local --views-only
# 6. Recompile and serve
fraiseql run

Confiture uses a confiture.yaml configuration file:

confiture.yaml
project:
name: my-fraiseql-app
environments:
local:
database:
host: localhost
port: 5432
database: myapp
user: postgres
password: postgres
schema_dirs:
- db/schema/00_extensions
- db/schema/01_write
- db/schema/02_read
- db/schema/03_functions
migrations_dir: db/migrations
production:
database:
host: ${DB_HOST}
port: ${DB_PORT}
database: ${DB_NAME}
user: ${DB_USER}
password: ${DB_PASSWORD}
schema_dirs:
- db/schema/00_extensions
- db/schema/01_write
- db/schema/02_read
- db/schema/03_functions
migrations_dir: db/migrations
ScenarioMediumCommand
Fresh dev environmentBuildconfiture build --env local
CI/CD test databaseBuildconfiture build --env ci
Add column to productionMigrateconfiture migrate up
Test with realistic dataSyncconfiture sync --from prod --to local --anonymize
Rename column on 50M row tableSchema-to-Schemaconfiture migrate schema-to-schema ...
Reset local databaseBuildconfiture build --env local