diff --git a/scripts/neon-startup.py b/scripts/neon-startup.py index 7909fe26..3b3698fa 100644 --- a/scripts/neon-startup.py +++ b/scripts/neon-startup.py @@ -94,6 +94,9 @@ log(f" ✅ {len(files)} migrations attempted (batched)") all_versions = "','".join(f.split("_")[0] for f in files) run(f'{PSQL} -d appflowy -c "INSERT INTO auth.schema_migrations (version) SELECT unnest(array[\'{all_versions}\']) ON CONFLICT DO NOTHING"', timeout=30) +# Pre-create tables that GoTrue migrations fail to create due to ordering bugs +run(f'{PSQL} -d appflowy -c "CREATE TABLE IF NOT EXISTS auth.one_time_tokens (id uuid PRIMARY KEY, user_id uuid, token_type text NOT NULL, token_hash text NOT NULL, expires_at timestamptz NOT NULL, created_at timestamptz NOT NULL DEFAULT now())"', timeout=10) + # Sync to public schema for GoTrue binary run(f'{PSQL} -d appflowy -c "DROP TABLE IF EXISTS public.schema_migrations; CREATE TABLE public.schema_migrations AS SELECT * FROM auth.schema_migrations"', timeout=10) log(" Migration tracking synced")