Skip to content

Instantly share code, notes, and snippets.

@wasdee
Created December 6, 2024 03:48
Show Gist options
  • Save wasdee/6946d68fb3b2db1cc92202dfb0acb24c to your computer and use it in GitHub Desktop.
Save wasdee/6946d68fb3b2db1cc92202dfb0acb24c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# mise description="Generate the DB schema for the AI Contexts"
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
mkdir -p ./AIContexts/
docker run --rm -v "$PWD/AIContexts:/data" postgres:15 \
pg_dump $POSTGRES_URL -s -O -x -n public -t public.* -f /data/db_schema.sql
echo "Please follow up by asking ai (Cursor Long Context Chat) to create compressed version of the db schema
Rewrite this DB schema for AI context:
- Shorten it by incorporating foreign keys, indexes, primary keys, and unique constraints directly into CREATE TABLE statements.
- Remove views, `SET` statements, and `create policy` statements.
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment