Repository navigation
Diwan Database 0.2.0
Diwan Database 0.2.0
Fixes and Laravel ports that apps built on 0.1.0 reached for. Every change is an addition: code
written for 0.1.0 compiles and runs unchanged.
Install
implementation("org.aristonis:diwan-database:0.2.0")
implementation("org.aristonis:diwan-database-sqlite:0.2.0") // or -pgsql
implementation("org.aristonis:diwan-database-eloquent:0.2.0") // models, optional
implementation("org.aristonis:diwan-database-android:0.2.0") // Android driver, optionalWhat's new
- Column collation:
table.string("code").collation(Collation.BINARY)gives the same byte order
on PostgreSQL and SQLite from one migration;collation("name")names a database collation. The
SQLite table rebuild keeps it. - Foreign key names:
constrained(table, column, name)andreferences(column, name), for
long table names that pass PostgreSQL's 63-byte limit. - Model builder:
fillAndInsert,fillAndInsertOrIgnoreandfillAndInsertGetIdinsert many
rows in one statement with casts and timestamps;whereBelongsTofilters children by a parent;
pluck(column, key)returns a map. - Instant cast:
Casts.instant()writes aninstantcolumn in instant form whatever the
model's timestamp format. - SQLite transaction mode: the
transaction_modeconnection option (immediate) makes two
transactions that read then update one row wait for each other instead of failing.
Changed and fixed
- SQLite accepts the
NO_KEY_UPDATEandKEY_SHARErow locks as no-ops, as Laravel does. - Driver failure messages name the kind Diwan recognised and the SQLite result code, after the
same text as before. busy_timeoutnow reaches SQLite file databases when you set it.cursorPaginateworks when ordered by a date or time column.- A SQLite commit no longer starts a new transaction, and a commit that fails leaves the
connection usable.
Links
- Documentation: https://aristonis.org/open-source/diwan-database/docs/main/home
- Full changelog: CHANGELOG.md
- Report a security problem privately: SECURITY.md