Skip to content

v0.3.1

Choose a tag to compare

@mekadalibrahem mekadalibrahem released this 09 Nov 19:33
· 23 commits to main since this release

Diwan Database 0.3.1

A fix release for 0.3.0, from reports by apps on 0.3.0. Code written for 0.3.0 compiles and runs
unchanged.

Install

implementation("org.aristonis:diwan-database:0.3.1")
implementation("org.aristonis:diwan-database-sqlite:0.3.1")   // or -pgsql
implementation("org.aristonis:diwan-database-eloquent:0.3.1") // models, optional
implementation("org.aristonis:diwan-database-android:0.3.1")  // Android driver, optional
testImplementation("org.aristonis:diwan-database-testing:0.3.1") // test support

Fixed

  • SQLite and Android truncate with restrict keys: truncate() and truncate(List) failed with
    a foreign key violation on a table whose restrictOnDelete() key refers to its own table, so
    RefreshDatabase truncate mode left the rows behind and later test classes failed on duplicates.
    SQLite checks a restrict key row by row, even when deferred. When such a key links the listed
    tables, the deletes now run outside a transaction with foreign key enforcement off, and any row
    left pointing at an emptied table fails the truncate and undoes it. Other keys keep their cascade
    and set-null actions. Inside a transaction, such a key still fails.
  • PostgreSQL restrict violations: SQL state 23001 (restrict_violation, raised for a
    restrictOnDelete() key) is now a ForeignKeyViolationException, and
    DriverException.error().key() names the constraint, as for 23503.

Links