I built pistachio, a declarative schema tool for PostgreSQL
Описание и применение
Pistachio упрощает управление схемой PostgreSQL, позволяя редактировать один декларативный SQL‑файл, генерировать и применять изменения в стиле Terraform, а также проверять idempotency через dump‑plan цикл.
Задача
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