Changelog¶
1.4.0 - 2026-11-15¶
- BREAKING:
--allow-table-rebuildis renamed to--allow-rebuild,HAZEL_ALLOW_TABLE_REBUILDtoHAZEL_ALLOW_REBUILD, andallow-table-rebuildin the configuration file toallow-rebuild. The old names are no longer accepted.
1.3.0 - 2026-11-15¶
plan --no-createandapply --no-createfail when the database file does not exist, instead of taking it as an empty database or creating it.HAZEL_NO_CREATEandno-createin the configuration file set it too.
1.2.0 - 2026-11-15¶
fmtprints the name of each file it rewrites, as--checkprints the files it would rewrite. It writes a file by renaming a new one over it, so a failure partway through leaves the file as it was; the directory of the file must be writable.
1.1.0 - 2026-11-15¶
- The
-- hazel:backfill EXPRESSIONdirective on a column fills the rows already in the table with the value of the expression, when the plan adds the column or makes itNOT NULL. An added column is filled in every row and a column madeNOT NULLin the rows where it is NULL, with anUPDATEbefore theSET NOT NULL, or by the copy when the table is rebuilt. So aNOT NULLcolumn with noDEFAULTcan be added to a table that has rows, and a column that holds NULLs can be madeNOT NULL.
1.0.0 - 2026-11-14¶
- hazel is generally available.
0.1.0 - 2026-11-14¶
-
A demo image,
ghcr.io/winebarrel/hazel-demo, bundles hazel, sqlite3 and a sample database:docker run --rm -it ghcr.io/winebarrel/hazel-demo. -
A name written in single quotes where SQLite expects a name, such as
CREATE TABLE 'sq' ('b' TEXT), is read as that name.dumpand the CREATE statements hazel runs keep such a name as it is written. -
The output goes through the command in
HAZEL_PAGER, run withsh -c(cmd /con Windows), when it goes to a terminal.--pageruses the pager for any output, and--no-pagernever does; withoutHAZEL_PAGER, neither does anything. The pager starts on the first output, so a command that prints nothing, or fails before it prints, does not open it. -
plan,applyanddiffwrite the CREATE statements they run in the layout ofdump: a CREATE TABLE has one column or constraint per line, and names lose the quotes they do not need. The statements are kept that way in the database. -
A CREATE statement that ends with a
--comment gets its;on the next line in the output ofplan,applyanddiff. -
hazel fmt SCHEMA_FILE...lays out the schema files in place, the waydumpwrites the statements. The statements are separated by one blank line, the comments before a statement stay before it, and a comment on the line of a;stays on that line. Statements that hazel does not manage and those marked with-- hazel:executeare left as they are. The files are loaded together before and after, and nothing is written unless both give the same schema.--checkwrites nothing, prints the files that are not formatted and exits with status 2 when there are any.--strip-renamed-fromdrops the-- hazel:renamed-fromdirectives. -
hazel dump --split=DIRwrites a file for each table, view and virtual table, named after it with.sql, holding its CREATE statement, then its indexes and triggers. The directory is created if it does not exist, a file of the same name is overwritten, and files of objects no longer in the database are left alone. A name that differs from an earlier one in case only gets_2,_3and so on, and a name with/or\is an error. -
hazel dump DBprints the schema of a database as the CREATE statements that make it: each table followed by its indexes and triggers, then the views, each followed by its triggers. Given back as the schema file, the dump plans clean. A CREATE TABLE is laid out with one column or constraint per line, indented by four spaces; nothing else in the statements changes but the whitespace and the quotes of names that do not need them.--no-formatprints the statements as SQLite keeps them, and-I/-Eselect the tables, views and virtual tables. -
hazel apply DB SCHEMA_FILE...runs the plan in one transaction, started withBEGIN IMMEDIATE, which waits up to--busy-timeout(5s by default) for the write lock. It prints each statement with its time, runs the statements marked with-- hazel:executewhose condition holds after the DDL, checks the foreign keys before the commit, and rolls everything back when a statement fails.--skip-foreign-key-checkturns the foreign key check off, and-- hazel:skip-foreign-key-checkleaves one table out of it. The condition of-- hazel:executemust return 0 or 1; any other result, NULL and no rows included, is an error.planshows those statements too, with a note when their condition cannot be evaluated before the DDL. -
The
hazelcommand, withplananddiff.plan DB SCHEMA_FILE...prints the DDL that takes a database to the schema files, anddiff OLD_SCHEMA_FILE NEW_SCHEMA_FILEthe DDL that takes one schema file to another. A plan that rebuilds a table fails with exit status 3 unless--allow-table-rebuildis given,--checkexits with status 2 when there are changes, and-I/-Eselect the tables, views and virtual tables by name. Options can also come from environment variables (HAZEL_*) and from a YAML file given with-C.