Skip to content

Commit 3689f14

Browse files
committed
docs(docker/README.md): added a troubleshooting note about the app_schema_version/Realtime migration error
1 parent 09b4c4f commit 3689f14

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docker/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,36 @@ If you modify the CloudSync source code, rebuild the CLI image and restart:
199199
make postgres-supabase-rebuild SUPABASE_WORKDIR=~/supabase-local
200200
```
201201

202+
### Supabase Realtime Migration Error (app_schema_version)
203+
204+
If Supabase Realtime fails to start with:
205+
206+
```
207+
ERROR 42P01 (undefined_table) relation "app_schema_version" does not exist
208+
```
209+
210+
it's caused by CloudSync's `app_schema_change` event trigger firing during
211+
migrations while Realtime uses a restricted `search_path`. Fix it by
212+
fully qualifying the table in the trigger function:
213+
214+
```sql
215+
CREATE TABLE IF NOT EXISTS public.app_schema_version (
216+
version BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY
217+
);
218+
219+
CREATE OR REPLACE FUNCTION bump_app_schema_version()
220+
RETURNS event_trigger AS $$
221+
BEGIN
222+
INSERT INTO public.app_schema_version DEFAULT VALUES;
223+
END;
224+
$$ LANGUAGE plpgsql;
225+
226+
DROP EVENT TRIGGER IF EXISTS app_schema_change;
227+
CREATE EVENT TRIGGER app_schema_change
228+
ON ddl_command_end
229+
EXECUTE FUNCTION bump_app_schema_version();
230+
```
231+
202232
## Development Workflow
203233

204234
### 1. Make Changes

0 commit comments

Comments
 (0)