ddl-export-snapshot-management
DDL Export & Snapshot Management
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 18
- Forks
- 6
01 前言 Front Matter
- name
- ddl-export-snapshot-management
- metadata
- { "original-index": 12, "short-description": "DDL Export & Snapshot Management" }
- description
- DDL Export & Snapshot Management
02 资源文件 1
- 参考文档skill.json161 B
03 SKILL.md 正文
DDL Export & Snapshot Management
What
A suite of Node.js scripts that export database schemas to local files for offline analysis, code review, and version control. Three complementary tools produce different views of the same database.
Why
You can't grep a live database. By exporting schemas to local files, you can:
- Search across all procedures with grep/ripgrep
- Track schema changes over time via git
- Code review DDL changes before and after deployment
- Work offline when VNET blocks database access
How
Three export layers
| Tool | Command | Output | Best For |
|---|---|---|---|
export_schema.js |
node scripts/audit/export_schema.js --env dev --db MyDB |
schemas/public.sql (monolithic pg_dump) |
Full schema backup |
generate_simple_ddl.js |
node scripts/audit/generate_simple_ddl.js --env dev --db MyDB |
simple_ddl/public/table_*.sql (per-table) |
Table structure review |
generate_templated_ddl.js |
node scripts/audit/generate_templated_ddl.js --env dev --db MyDB |
schemas/public/Procedures/*.sql, Tables/*.sql (per-object) |
Procedure-level grep |
Output structure
database/postgresql/dev/<server>/<database>/
schemas/
public.sql # monolithic pg_dump
public/
Procedures/
AddApplicant__ed99d064c842.sql
GetApplicant__9a46e1f5494b.sql
...
Tables/
Applicant__<hash>.sql
...
Functions/
Comments/
Grants/
simple_ddl/
public/
table_Applicant.sql
table_Hospital.sql
...
Multi-target export
# Export all targets defined in config/targets.yaml
node scripts/audit/export_all.js
Configuration
Targets are defined in config/targets.yaml:
targets:
- name: QA
host: ${DB_HOST_QA}
databases: [MyDB_QA, OtherDB_QA]
- name: DEV
host: ${DB_HOST_DEV}
databases: [MyDB_DEV]
Refresh Workflow
Before a code review, always refresh snapshots:
# 1. Monolithic schema dump
node scripts/audit/export_schema.js --env dev --db myapp_dev
# 2. Per-table DDLs
node scripts/audit/generate_simple_ddl.js --env dev --db myapp_dev
# 3. Per-object split files (Procedures/, Tables/, etc.)
node scripts/audit/generate_templated_ddl.js --env dev --db myapp_dev
When to Use
- Before every code review (refresh from live database)
- After every deployment (capture post-deployment state)
- When onboarding to a new database (initial snapshot)
Where We Used It
- DA-102: Refreshed all 3 layers to verify column renames and procedure updates were applied in DEV. Grep of refreshed split files confirmed 0 old misspelled column references across all 87 procedures.
- All tickets: Initial schema discovery and procedure analysis
Gotchas
generate_templated_ddl.jsdeletes the monolithicpublic.sqlifclean_schema_rootis enabled -- runexport_schema.jsagain after it- Simple DDL only exports table structures (no procedures, views, etc.)
- File hashes in names (e.g.,
__ed99d064c842) change when the object definition changes -- git will show a delete + create, not a rename - VNET-blocked servers will fail silently or timeout -- always check output
Category: Tooling | Origin: All tickets
04 同仓库更多 Skills
yeet
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
wrangler
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
workspace-skill-discovery
Discover and include ALL skills across the workspace — not just global ones. Use at the start of every session or when the user asks about available skills. Ensures project-level skills (under .claude/skills/ or skills/ in any repo) are never missed.
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
winui-app
Create, build and design WinUI 3 desktop apps with C# and the Windows App SDK following Microsoft's official guidance and CommunityToolkit. Covers XAML, navigation, theming, accessibility and deployment.
windows-brain-script-portability
Scripts in ~/.claude/scripts/ that run on a Windows brain: use the python3.cmd shim and not bare python3, and reconfigure stdout to UTF-8 if you print symbols. Use it when writing a brain script or triaging a Windows-only crash.