Version your flows
Current Compilation Limitations
Section titled “Current Compilation Limitations”Important: The current version of pgflow’s compiler has several limitations:
- Always creates a new migration file for any changes
- Does not provide automatic update functionality for existing flows
- Cannot safely change step dependencies or flow structure
For any changes to an existing flow, you must:
- Manually handle migration files
- For non-breaking changes, manually update using SQL commands
Understanding Safe vs. Breaking Changes
Section titled “Understanding Safe vs. Breaking Changes”Before making changes to your flows, understand which modifications are safe:
Safe Changes | Breaking Changes |
---|---|
✅ Modifying step implementation | ❌ Adding/removing steps |
✅ Adjusting retry parameters | ❌ Changing step dependencies |
✅ Updating timeout values | ❌ Modifying input/output types |
✅ Bug fixes within steps | ❌ Changing step slug names |
Version Management Strategy
Section titled “Version Management Strategy”pgflow uses the flow’s slug
as its identifier, so to create a new version:
- Create a new flow definition file with a versioned slug (e.g.,
greet_user_v2.ts
) - Manually manage migration files:
- Keep previous migration files for existing runs
- Create new migrations for the new flow version
export default new Flow<Input>({ slug: 'greet_user_v2', // Note the versioned slug // ...configuration})
Updating Non-Breaking Configuration Options
Section titled “Updating Non-Breaking Configuration Options”For non-breaking changes like adjusting retry settings or timeouts, you must manually update the database with SQL commands.
We’ve created a detailed guide on how to update flow options that covers:
- All available configuration options
- SQL commands for updating flows and steps
- Best practices for maintaining compatibility
For any non-breaking changes to existing flows, refer to this guide rather than recompiling.