Skip to content

Commit 1d22df3

Browse files
committed
fix: remove deprecated create_realtime_partition function and update test references
- Deleted the create_realtime_partition SQL function and related comments - Updated test scripts to no longer call create_realtime_partition - Replaced pgflow.read_with_poll with pgmq.read_with_poll in client code - Ensured tests focus on existing functionality without partition creation - Minor adjustments to test setup for consistency and clarity
1 parent e1462be commit 1d22df3

File tree

57 files changed

+750
-1443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+750
-1443
lines changed

.changeset/pgmq-version-bump.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@pgflow/core': minor
3+
'@pgflow/edge-worker': minor
4+
---
5+
6+
BREAKING CHANGE: This version requires pgmq 1.5.0 or higher and will NOT work with pgmq 1.4.x.
7+
8+
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.
9+
10+
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.

.claude/skills/migration-management/SKILL.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,20 @@ cd pkgs/core
6565
./scripts/atlas-migrate-diff your_feature_name # NO pgflow_ prefix (auto-added)
6666
# Creates: supabase/migrations/TIMESTAMP_pgflow_your_feature_name.sql
6767

68+
# ⚠️ CHECK: If changing function signatures, review the migration for CREATE OR REPLACE
69+
# See Troubleshooting section if you get "cannot change return type" errors
70+
6871
pnpm nx verify-migrations core # Validates migration + checks schemas synced
6972
pnpm nx gen-types core # Regenerate TypeScript types
7073
pnpm nx test:pgtap core # Verify everything works
7174
```
7275

76+
**If you manually edit a migration** (e.g., to add DROP FUNCTION):
77+
```bash
78+
./scripts/atlas-migrate-hash --yes # Regenerate checksums after manual edits
79+
pnpm nx verify-migrations core # Then verify it works
80+
```
81+
7382
### Naming Conventions
7483

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

181190
## Troubleshooting
182191

192+
### ⚠️ CRITICAL: Atlas Limitation with Function Signature Changes
193+
194+
**Atlas DOES NOT detect function return type or parameter type changes!**
195+
196+
If Atlas generates `CREATE OR REPLACE FUNCTION` and the function signature changed, the migration will fail with:
197+
```
198+
ERROR: cannot change return type of existing function
199+
```
200+
201+
**Solution:** Manually edit the generated migration to add DROP first:
202+
```sql
203+
-- WRONG (Atlas generates this):
204+
CREATE OR REPLACE FUNCTION pgflow.my_func() RETURNS NEW_TYPE ...
205+
206+
-- CORRECT (manually fix to):
207+
DROP FUNCTION IF EXISTS pgflow.my_func(param_types_here);
208+
CREATE FUNCTION pgflow.my_func() RETURNS NEW_TYPE ...
209+
```
210+
211+
**When this happens:**
212+
- Changing `RETURNS SETOF type` to `RETURNS TABLE(...)`
213+
- Changing `RETURNS type1` to `RETURNS type2`
214+
- Changing parameter types
215+
- Adding/removing parameters
216+
217+
**Always test migrations with `pnpm nx supabase:reset core` to catch this!**
218+
183219
### Migration name exists
184220

185221
```bash

0 commit comments

Comments
 (0)