Migrating data from one version of a custom app to the next

Introducing ODK-X DB Migrator: A Tool for Seamless Database Migrations

Hello ODK-X Community!

I’m excited to share a tool I’ve developed to address one of the more challenging aspects of maintaining ODK-X deployments: migrating data between different versions of ODK-X databases.

ODK-X DB Migrator

This open-source tool helps you migrate data from one ODK-X SQLite database to another with a different schema. It’s particularly useful when you need to upgrade your ODK-X application to a new version with schema changes while preserving your existing data.

Key Features:

  • Table-by-table migration with detailed progress tracking
  • Automatic pseudotype conversions between string and array types
  • Attachment management and resizing tools
  • Custom transformation logic for complex data mappings
  • Command-line interface for easy integration into workflows
  • Ability to resize attachments (jpg) and ensure consistency

How It Works:

  1. Pull the database from your current ODK-X app
  2. Pull an empty database from your new ODK-X app version
  3. Run the migration tool to transfer and transform your data
  4. Manage and resize attachments as needed
  5. Push the migrated database back to your device

Real-World Tested:

This tool was developed for and tested with field research applications involving complex form structures and thousands of records with attachments. It successfully handles the conversion between different pseudotypes (eg. changes from a “string” or “number” to an array of the same type) stored in the _column_definitions table.

Getting Started:

The tool is available on GitHub - r0ssing/odkx-db-migrator

It’s released under the MIT License, so you’re free to use and modify it for your own ODK-X projects.

I welcome feedback, contributions, and questions about the tool. If you’re facing challenges with database migrations in your ODK-X projects, I hope this tool can help make the process smoother.


Looking forward to hearing about your experiences with the tool!

//emil

From Paris with :heart:

2 Likes