#!/usr/bin/env bash # v0.942: Generate 000_full_schema.sql from a DB with all migrations applied. # Prerequisite: PostgreSQL with veza DB, all migrations already run. # Usage: ./scripts/generate_full_schema.sh # Or: DATABASE_URL=postgres://... ./scripts/generate_full_schema.sh set -e DB_URL="${DATABASE_URL:-postgres://veza:veza_password@localhost:5432/veza?sslmode=disable}" OUTPUT="veza-backend-api/migrations/000_full_schema.sql" echo "Generating full schema from $DB_URL -> $OUTPUT" pg_dump "$DB_URL" --schema-only --no-owner --no-privileges -f "$OUTPUT" echo "Done. Review $OUTPUT before committing."