fix: use postgres_ai schema for pg_statistic + add --provider flag for Supabase

Summary

  • Fix pg_statistic view schema mismatch (was public, should be postgres_ai)
  • Add --provider flag to prepare-db for managed Postgres services (e.g., Supabase)
  • Add config consistency tests to prevent schema mismatches

Closes #94 (closed)

Changes

Bug Fix

config/target-db/init.sql was creating public.pg_statistic but verify checks for postgres_ai.pg_statistic. Fixed to use correct schema everywhere.

New Feature: --provider flag

postgresai prepare-db <conn> --provider supabase

For Supabase:

  • Skips role creation (create user via Supabase dashboard)
  • Skips ALTER USER ... SET search_path (restricted by Supabase)
  • Skips search_path verification in --verify mode

Tests

  • Added config-consistency.test.ts to validate schema consistency
  • Added provider-specific buildInitPlan tests

Test plan

  • bun test config-consistency - validates schema references
  • bun test --test-name-pattern "provider" - tests provider logic
  • bun test --test-name-pattern "buildInitPlan|verifyInitSetup" - existing tests still pass

Merge request reports

Loading