Skip to content

Diwan Database 0.2.0

Choose a tag to compare

@mekadalibrahem mekadalibrahem released this 08 Nov 00:35
· 38 commits to main since this release

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, optional

What'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) and references(column, name), for
    long table names that pass PostgreSQL's 63-byte limit.
  • Model builder: fillAndInsert, fillAndInsertOrIgnore and fillAndInsertGetId insert many
    rows in one statement with casts and timestamps; whereBelongsTo filters children by a parent;
    pluck(column, key) returns a map.
  • Instant cast: Casts.instant() writes an instant column in instant form whatever the
    model's timestamp format.
  • SQLite transaction mode: the transaction_mode connection 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_UPDATE and KEY_SHARE row 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_timeout now reaches SQLite file databases when you set it.
  • cursorPaginate works 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