Repository navigation
drizzle-cli v0.2.0
drizzle 0.2.0
Breaking changes
- (msrv) The minimum supported Rust version is 1.98 (was 1.95).
- (api)
Drizzle::newtakes only the connection and builds the schema withDefault:let (db, Schema { users, .. }) = Drizzle::new(conn). Delete the second argument. When the pattern doesn't name the schema type, put it on the call (Drizzle::<Schema>::new(conn); MySQLDrizzle::<_, Schema>::new(conn)), and writelet (db, ()) = Drizzle::new(conn)for no schema.hyperdrive::connectandconnect_rawdrop their schema argument the same way. - (macros) Generated per-column types live in a module named after the table in snake case:
users::Name(wasUsersName),users::AliasedName(wasAliasedUsersName), and the insert markersusers::NameSet/users::NameNotSet(wereUsersNameSet/UsersNameNotSet). Code that names these types needs the new paths; code that usesusers.nameis unchanged. In exchange, aUsertable can have arole: UserRolecolumn, which used to fail with a duplicate definition. A module of your own with the table's snake-case name, next to the table (mod usersbesidestruct Users), now collides; rename one of them. - (durable) The Durable Objects driver is built from the object's
State:Drizzle::new(DurableStorage::new(&mut state))instead ofDrizzle::new(state.storage().sql()). Build it inDurableObject::newand keep it on the object.Transaction::inner()and the prepared-statement executors take&DurableStorage(.sql()gives theSqlStorage), andTransaction::config()is gone. - (schema)
DEFAULT_SQL/default_sqlis removed on SQLite, PostgreSQL and MySQL.defaultnow covers both cases: a quoted string is a SQL value (default = "guest"), and an unquoted SQL keyword or function call is emitted as a database expression (default = CURRENT_TIMESTAMP,default = now(),default = strftime("%s", "now")). Replacedefault_sql = "CURRENT_TIMESTAMP"withdefault = CURRENT_TIMESTAMP. - (sqlite) The SQLite math functions (
sqrt,ceil,floor,trunc,exp,ln,log*,power,pi) need the newmathfeature and theMathExtimport. Stock rusqlite/libsql builds don't ship them, so they used to fail at runtime. - (sqlite)
intersect_all/except_allare gone from the SQLite builders. SQLite has noINTERSECT ALL/EXCEPT ALL. - (transactions) The public
beginAPIs and explicit transaction guards are removed. Transactions are scoped todb.transaction(config, |tx| ...), which owns commit and rollback. - (json) JSON columns convert through
drizzle::core::Json<T>, and the table macros no longer implement traits on payload types. Compare a JSON column with a wrapped value (eq(profiles.settings, Json(value))), and expectJson<T>when selecting a JSON column on its own (.0or.into_inner()gives the payload). Application crates no longer need aserde_jsondependency. - (sqlite) Select models type a nullable column that has a
default/default_fnasOption<T>(previouslyT, which failed to decode rows holding NULL). - (macros) Generated Select/PartialSelect models implement
Debug,Clone,PartialEqandDefaulton every dialect whenever all field types do. A hand-written impl of one of these traits for a generated model now conflicts; delete it. - (joins) The NATURAL join helpers (
natural_join,natural_left_join, ...) take only the table. A NATURAL join matches columns by name and rejects an ON clause, so the old form always failed. - (values) A setter argument that does not fit its column type (an out-of-range integer, a JSON payload that fails to serialize) panics instead of being stored as NULL.
- (sqlite)
Drizzle::conn_mutis no longerconst: it drops libsql's cached statement, which belongs to the connection the caller may replace. - (macros) Column options that used to be ignored are errors: unknown
#[column]keys (SQLite), invalidon_delete/on_updateactions and non-Table::columnreferences (SQLite), a second#[column]attribute and value-lesscheck/references/relation(PostgreSQL), and#[derive(Clone | Copy | Debug | Default)]in a separate derive beside a schema derive. - (macros)
include_migrations!with a missing directory is a compile error instead of an empty list. - (cli) A listed schema path that doesn't exist, or a pattern that matches no file, is an error (it used to be skipped, which could plan
DROP TABLE).migrate,pushandpullexit non-zero when they can't do their job. Theuuid,serde,chrono,cidr,geo-typesandbit-vecCLI features do nothing now. - (postgres)
pushno longer manages roles it wasn't told about: the library'spushleaves every role alone, and the CLI followsentities.roles(off by default).
Added
- (jiff) A
jifffeature:jiff::civil::{Date, Time, DateTime}andjiff::Timestampcolumns on SQLite, PostgreSQL (incl. the AWS Data API) and MySQL. - Date and time values (chrono, time, jiff) compare in filters:
eq(events.day, day). select_distinct_onon PostgreSQL transactions and savepoints.examples/durable_object: a Cloudflare Worker whose Durable Object migrates in its constructor and writes through a transaction.
Fixed (highlights)
- Durable Objects:
transaction(),savepoint()andmigrate()work. They ranBEGIN/SAVEPOINTstatements, which Durable Object SQL rejects; they now run through the storage'stransactionSync. - Operator precedence and set-operation grouping in generated SQL; SQLite named placeholders,
OFFSETwithoutLIMIT,INSERT ... SELECTwith an upsert; MySQLOFFSETafterUNION; multi-row inserts that omit different columns; view definitions with bound values; relational filters with self-referencing subqueries. .execute()on RETURNING statements (SQLite drivers); libsql statement reuse;Sendfutures in tokio-postgres transactions; PostgreSQL stale cached statements after a migration; commit after a swallowed statement error now fails; rollback errors reported with their cause.timevalues read back on SQLite (TIME was unreadable) and decode as selected columns; chrono/time fields compile on turso and libsql.- The
chronofeature builds with only a SQLite driver (features = ["rusqlite", "chrono"]failed to compile). migrate --plan,--dry-runand--verifyno longer create the database, the tracking table, or upgrade a legacy tracking table.
The full list is in CHANGELOG.md.
drizzle-cli v0.2.0
Installation
cargo install drizzle-cli --locked --all-features
# or: cargo binstall drizzle-cliPrebuilt binaries for common targets are attached below.
Verify
drizzle --versionChecksums
See checksums-sha256.txt for SHA256 hashes.
What's Changed
- feat: add first-class MySQL dialect and drivers by @themixednuts in #78
- ci: dry-run workspace before publishing by @themixednuts in #64
- feat(schema): simplify database defaults by @themixednuts in #80
- chore: pre-release cleanup for v0.2.0 by @themixednuts in #82
- fix: release audit — SQL generation, value conversion and driver fixes by @themixednuts in #83
- fix: unblock the 0.2.0 release PR by @themixednuts in #84
- fix(cli): gate migration-plan helpers on the drivers that use them by @themixednuts in #85
- ci: correct the AGENTS.md note on when CI runs by @themixednuts in #87
- ci: check drizzle-cli driver builds for warnings; bump MSRV to 1.98 by @themixednuts in #86
Full Changelog: v0.1.16...v0.2.0