Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/pgmq-version-bump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@pgflow/core': minor
'@pgflow/edge-worker': minor
---

BREAKING CHANGE: This version requires pgmq 1.5.0 or higher and will NOT work with pgmq 1.4.x.

The code now depends on schema changes introduced in pgmq 1.5.0 (specifically the headers column in message_record type). The compatibility layer that allowed pgflow to work with pgmq 1.4.x has been removed.

If you are using Supabase, pgmq 1.5.0+ is included by default in recent versions. If you are self-hosting, you must upgrade pgmq to version 1.5.0 or higher before upgrading pgflow.
36 changes: 36 additions & 0 deletions .claude/skills/migration-management/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,20 @@ cd pkgs/core
./scripts/atlas-migrate-diff your_feature_name # NO pgflow_ prefix (auto-added)
# Creates: supabase/migrations/TIMESTAMP_pgflow_your_feature_name.sql

# ⚠️ CHECK: If changing function signatures, review the migration for CREATE OR REPLACE
# See Troubleshooting section if you get "cannot change return type" errors

pnpm nx verify-migrations core # Validates migration + checks schemas synced
pnpm nx gen-types core # Regenerate TypeScript types
pnpm nx test:pgtap core # Verify everything works
```

**If you manually edit a migration** (e.g., to add DROP FUNCTION):
```bash
./scripts/atlas-migrate-hash --yes # Regenerate checksums after manual edits
pnpm nx verify-migrations core # Then verify it works
```

### Naming Conventions

- snake_case (e.g., `add_root_map_support`)
Expand Down Expand Up @@ -180,6 +189,33 @@ git commit -m "feat: consolidate step validation and error handling"

## Troubleshooting

### ⚠️ CRITICAL: Atlas Limitation with Function Signature Changes

**Atlas DOES NOT detect function return type or parameter type changes!**

If Atlas generates `CREATE OR REPLACE FUNCTION` and the function signature changed, the migration will fail with:
```
ERROR: cannot change return type of existing function
```

**Solution:** Manually edit the generated migration to add DROP first:
```sql
-- WRONG (Atlas generates this):
CREATE OR REPLACE FUNCTION pgflow.my_func() RETURNS NEW_TYPE ...

-- CORRECT (manually fix to):
DROP FUNCTION IF EXISTS pgflow.my_func(param_types_here);
CREATE FUNCTION pgflow.my_func() RETURNS NEW_TYPE ...
```

**When this happens:**
- Changing `RETURNS SETOF type` to `RETURNS TABLE(...)`
- Changing `RETURNS type1` to `RETURNS type2`
- Changing parameter types
- Adding/removing parameters

**Always test migrations with `pnpm nx supabase:reset core` to catch this!**

### Migration name exists

```bash
Expand Down
Loading
Loading