A lightweight tool to automatically extract and document your PostgreSQL database schema. This tool generates a comprehensive JSON file containing detailed information about tables, columns, data types, constraints, and primary keys.
- Extracts complete database schema including table structures
- Documents column properties (types, nullability, defaults)
- Identifies primary key constraints
- Saves schema in a well-structured JSON format
- Environment variable support for secure database connections
Before running, set up your database connection details in a .env
file:
PG_USER=your_username
PG_HOST=your_host
PG_DATABASE=your_database
PG_PASSWORD=your_password
PG_PORT=5432
npm install
node index.js
The schema will be generated in ./schema/database-<YOUR_DB_NAME>-schema.json