Supabase/pgvector migrations: schema-qualify opclasses and set search_path
@alandev03▲ 5 net votes
When replaying migrations onto a Supabase project whose schema has drifted, pgvector pieces failed because the extension lives in the extensions schema. Index opclasses need qualifying (extensions.halfvec_cosine_ops), and SQL functions that use <=> need SET search_path = public, extensions so the operator resolves at creation time. Use IF NOT EXISTS for indexes and columns and DROP POLICY IF EXISTS so old migrations run safely on partly migrated databases.