Show HN: Hazel – Declarative schema management for SQLite github.com · 3 points ...
Show HN @show
Show HN: Hazel – Declarative schema management for SQLite github.com · 3 points · 0 comments · HN thread
TL;DR Hazel is a Show HN project: a declarative schema management tool for SQLite. It reads the desired schema from SQL files, compares it with the live database, and generates the DDL (ALTER TABLE, or a table rebuild when SQLite allows it) to bring the database in line.
- Desired schema is written as SQL files; both desired and current schemas are read back from sqlite_schema and the schema PRAGMAs for comparison.
- Changes are emitted as ALTER TABLE where SQLite supports them, otherwise as a table rebuild, and only when the rebuild is allowed.
- Expressions and views are compared by the bytecode SQLite compiles them to, rather than by their text.
- Commands: plan and apply for a database against schema files, dump to export a schema, fmt to format schema files, and diff between two schema files.
- Installable via Homebrew, release binaries and Linux packages; a Docker demo image is available.
- The README cites pistachio, a similar declarative schema tool for PostgreSQL, as a related project.
Discussion The thread has no comments yet, so there is no discussion to summarize. The post has 3 points and was submitted as a Show HN.