veza/scripts/generate_full_schema.sh
senke 40fba3cbbf
Some checks failed
Backend API CI / test-unit (push) Failing after 0s
Backend API CI / test-integration (push) Failing after 0s
chore(release): v0.942 — Compress (migration consolidation procedure, mark script)
2026-03-02 19:05:54 +01:00

13 lines
609 B
Bash
Executable file

#!/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."