-- 04/vector-store: enable the pgvector extension on the application database. -- -- This is the foundation for `packages/vector-store`'s pgvector adapter. Each -- collection lives in its own table named `vec__` with -- a `vector()` column plus HNSW + GIN + tenant-id indexes. The tables are -- created on demand at runtime by the adapter (`createCollection`); only the -- extension itself is provisioned here so the rest of the migration history -- stays free of dynamic vector-table churn. -- -- Notes for operators: -- * `CREATE EXTENSION` requires superuser privileges. On managed Postgres -- (RDS, Supabase, Neon, …) the extension is typically pre-allowlisted and -- this statement is idempotent. -- * Self-hosted Postgres needs the pgvector binaries installed -- (`apt install postgresql-16-pgvector` or the `pgvector/pgvector:pg16` -- Docker image used in CI). If the binaries are missing, the migration -- fails fast — preferable to silent breakage when the first `createCollection` -- call runs. -- * Rollback drops the extension via `DROP EXTENSION IF EXISTS vector CASCADE`; -- CASCADE destroys every `vec_*` table, so back up before reverting. CREATE EXTENSION IF NOT EXISTS vector;