Skip to content

v0.1.16 — a column that promised something it never did

Choose a tag to compare

@jorgejiro jorgejiro released this 14 Sep 21:35
· 86 commits to main since this release
43a416d

Nothing changes on screen. This one is entirely underneath, and it is worth one honest paragraph.

Install

Open this page on the phone, tap constanza-0.1.16.apk, install over the previous version. The database is rebuilt during this upgrade — see below. Nothing is lost, and a snapshot of the previous state is written before anything is touched.

A field that advertised a feature that does not exist

Every habit carried a sortOrder number, and the query that read the habit list sorted by it.

Nothing ever wrote a value into it. Not once, in any version. The editor set it to zero when you created a habit, and no screen in the app has ever offered a way to reorder anything. So every habit held the same zero, the sort had nothing to distinguish them by, and the database handed rows back in whatever order they happened to be stored.

0.1.15 fixed the visible half of that by sorting the habits screen by name. This release removes the cause: a column that described a manual ordering the app never had. A field like that is worse than clutter — the next person to read the code, months from now, reasonably concludes there is an ordering feature somewhere, and goes looking for it.

Why the database has to be rebuilt

The version of SQLite that ships with Android 12 — the oldest version this app supports — cannot remove a column from a table. That capability arrived in a later release. So removing the field means creating a new habits table, copying every row across, dropping the old one and renaming.

That is delicate here, because habits is the parent of four tables that are set to delete their rows automatically when their habit disappears: your schedules, your reminder times, every answer you have ever recorded, and the pending reminders. Dropping the old table at the wrong moment would take all four with it.

The upgrade counts the rows in all four tables before the rebuild and again after, and refuses to complete if a single one went missing — leaving the database untouched and rolled back rather than quietly emptied. That guard is not new; it was written the last time this table was rebuilt, and it is reused here. It was tested on a real Android 12 device image against a database seeded with habits, schedules, reminders and recorded answers.

Backup files

A backup exported by this version can no longer be read by an older build of the app, because the field it expects is gone. Rather than letting that surface as an unhelpful "invalid file", the format carries a version number that an older build now recognises and reports honestly.

Backups you exported before this release still import normally. The change only affects the other direction.