I built pistachio, a declarative schema tool for PostgreSQL
说明与用途
Pistachio 通过让开发者编辑单一声明式 SQL 文件,生成并应用类似 Terraform 的变更,并通过 dump‑plan 循环验证幂等性,从而简化 PostgreSQL 模式管理。
问题
Managing PostgreSQL schema changes with multiple migration files is cumbersome and error‑prone.
结果
Pistachio streamlines schema management by consolidating migrations into a single declarative file, providing clear diffs, idempotent applies, and round‑trip validation via dump and plan. It reduces drift and simplifies collaboration.
工作流
- Write the desired schema in a single SQL file (e.g., schema.sql).
- Run
pista plan schema.sqlto see the DDL diff that will be applied. - Run
pista apply schema.sqlto apply the changes to the database. - Run
pista plan schema.sqlagain to confirm no changes remain. - Use
pista dumpto export the current schema for backup or migration purposes. - For an existing database, run
pista dump > schema.sqlto generate the initial desired schema file and then edit it moving forward.
证据
Instead of piling up migration files, you keep editing one schema file as the desired state.
pista plan shows the diff, pista apply runs it, and a second plan reports no changes.
- 记录日期: 2026-09-07T05:40:41.162Z