1-- ============================================================================ 2-- AI Software Factory — PostgreSQL bootstrap extensions 3-- 4-- Mounted at /docker-entrypoint-initdb.d/01-extensions.sql by docker-compose 5-- and executed ONCE, only when the pgdata volume is EMPTY (first bootstrap). 6-- On a re-created volume (docker compose down -v) this runs again. 7-- ============================================================================ 8 9-- citext: case-insensitive text columns (used for unique email addresses, 10-- slugs, and other case-insensitive keys). 11CREATE EXTENSION IF NOT EXISTS citext; 12 13-- pg_trgm: trigram indexes for fast "contains"-style text search fallbacks 14-- and similarity queries (used alongside OpenSearch, not instead of it). 15CREATE EXTENSION IF NOT EXISTS pg_trgm; 16 17-- btree_gist: enables GiST indexes for range types and exclusion constraints 18-- (useful for interval-style date-range properties in databases). 19CREATE EXTENSION IF NOT EXISTS btree_gist; 20 21-- ---------------------------------------------------------------------------- 22-- pgvector (vector) — intentionally NOT installed yet. 23-- The AI/RAG phase (Phase 12, docs/tasks/phase-12-ai.md) will introduce 24-- embeddings + vector similarity search. When that lands, add here: 25-- 26-- CREATE EXTENSION IF NOT EXISTS vector; 27-- 28-- ...and update the postgres image tag in docker-compose.yml to a build that 29-- ships the extension, e.g. pgvector/pgvector:pg16-alpine (or install it in a 30-- custom image). Until then the extension is deliberately absent so we do not 31-- pin the image to an unneeded vendor build. 32-- ---------------------------------------------------------------------------- 33 34-- Confirm what got installed (shows in `docker compose logs postgres`): 35SELECT extname, extversion 36FROM pg_extension 37WHERE extname IN ('citext', 'pg_trgm', 'btree_gist'); 38