{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/2026-10-01-switching-avni-mobile-app-storage/","result":{"data":{"site":{"siteMetadata":{"siteUrl":"https://avniproject.org","twitterHandle":"@avniproject"}},"post":{"id":"5facb6c2-f163-5f00-ae6a-3f3d583401e5","html":"<p>A field worker in a village with no signal can still register a child, record a visit and sync it all a week later. That works because every Avni phone carries its own database. In 18.0, we start moving to a new one. It takes time, but it leaves us with a more stable app that we can keep making faster.</p>\n<p>Picture a relay. The old runner has carried our data for years and is tiring. The new runner is alongside, hand out. The handover is the only moment the baton can drop, and we have to make it thousands of times, phone by phone, one organisation per leg. So we run each handover slowly, and we watch every one.</p>\n<h2>The race : on one screen</h2>\n<table>\n<thead>\n<tr>\n<th>On the track</th>\n<th>What it means</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>The race</td>\n<td>Hand every phone's data from the old database to the new one</td>\n</tr>\n<tr>\n<td>18.0</td>\n<td>The new runner is on the track. No baton has changed hands yet</td>\n</tr>\n<tr>\n<td>The legs</td>\n<td>One organisation at a time, smallest first</td>\n</tr>\n<tr>\n<td>Your part</td>\n<td>Finish drafts and move to a custom dashboard. We check the rest</td>\n</tr>\n<tr>\n<td>Is it over?</td>\n<td>Moving data across is done and tested. Speed work for large organisations continues</td>\n</tr>\n</tbody>\n</table>\n<h2>Why : the old runner is tiring</h2>\n<p>The old database is no longer actively maintained. By February it had gone six months without a release. Each time Android moves forward, the database must keep pace, and with nobody coaching it, every upgrade became a coin toss. One security flaw with no fix, and our runner would have stopped mid-lap.</p>\n<p>So we brought in a new runner: one of the most widely used databases in the world, with plenty of people keeping it fit. Data on the phone stays encrypted, as before.</p>\n<h2>On your marks : 18.0 hands over nothing</h2>\n<p>18.0 puts the new runner on the track. Nobody crosses yet.</p>\n<p>Update the app and every user stays exactly where they are. A handover starts only when an administrator adds a user to the <strong>SQLite Migration</strong> user group, and they sync. We do that together with each organisation, on a date agreed with it.</p>\n<p>There is nothing to do yet. Avni's delivery and support team will contact your organisation with the details, including the date, before any of your users move.</p>\n<p>That group sits in every organisation's admin screen. Please don't use it yourself. A baton passed before both runners are ready is how it gets dropped. A user can be handed back, but only with the platform team, and their phone downloads all its data again.</p>\n<h2>Before the handover : what your organisation does</h2>\n<ul>\n<li><strong>Unfinished drafts are lost.</strong> A draft is a note in the old runner's pocket. It does not cross, and the app gives no warning. Ask field users to finish or discard drafts before their move date. Why not carry them over? The app already deletes any draft left untouched for 30 days, and building that bridge for a one-time move cost more than it saved. So the warning comes from us, in the briefing before your move.</li>\n<li><strong>My Dashboard is being retired.</strong> If your users still land on it, we set up a custom dashboard with you first and check its numbers match.</li>\n<li><strong>Some report cards and rules get rewritten.</strong> A few rule styles run slowly on the new database. We scan yours and fix what needs it.</li>\n<li><strong>Sync first.</strong> The handover waits until the phone has nothing left to upload, and it only happens on a sync the user starts.</li>\n</ul>\n<h2>The handover : one organisation per leg</h2>\n<p>The first leg is a small organisation with two users. Before the real thing, we rehearse it on a test copy of its data. Then one user crosses. Then the second. Only then does the next organisation step up.</p>\n<p>Each organisation gets one visit, and everything happens in it:</p>\n<ol>\n<li>Scan its rules and fix anything flagged as must-fix.</li>\n<li>Set up a custom dashboard if it still uses My Dashboard.</li>\n<li>Check its report cards, and rewrite any that count slowly.</li>\n<li>Check the numbers match on the old and new databases.</li>\n<li>Sign off, and hand over the first one or two users, during the field visit where we can.</li>\n</ol>\n<p>Then the rest of its users cross in batches, and we keep watching that leg for a month after.</p>\n<p>We start at two or three organisations a week, then pick up the pace. Large organisations run the last legs, once the handover has become boring. Boring is the goal.</p>\n<h2>Track notes : for the technically curious</h2>\n<p>Out goes Realm. In comes SQLite, through op-sqlite, with SQLCipher for encryption. We didn't rewrite the app. We built a layer on SQLite that behaves like Realm, and it translates rules written in Realm's query language to SQL as they run.</p>\n<p>The design notes are public, starting with the <a href=\"https://github.com/avniproject/avni-client/blob/18.0/docs/RealmToSqliteOverview.md\">technical overview</a>.</p>\n<hr>\n<p>If we run this right, the baton changes hands on every phone, and nobody in the field breaks stride.</p>","frontmatter":{"date":"October 01, 2026","title":"Switching the Avni Mobile App storage","author":"Himesh R","description":"Avni 18.0 replaces the database inside the mobile app. Here is why, and what it means for your organisation.","tags":["Avni","release","Software Engineering"],"image":null},"fields":{"slug":"/blog/2026-10-01-switching-avni-mobile-app-storage/"}}},"pageContext":{"id":"5facb6c2-f163-5f00-ae6a-3f3d583401e5"}},"staticQueryHashes":["1175525803","4080856488"]}