Paul Bădărău

Rails Migration: Leaving InventoryBase While Staff Work

Moving a live platform to Rails: replacing the sync service, importing the old database and checking records before source deletion, while staff keep working.

A UK property inventory agency asked me to move 14 years of inspection history out of InventoryBase and into a platform it owns. That is more than 25,000 properties, over 60,000 inspections, and more than 4 TB of reports and photos. The team used the system every day, so there was no weekend where everything could stop.

The same shape applies to leaving any hosted product that holds years of operational records. InventoryBase is the one I did.

Keeping more history made the eventual move larger

The agency had three reasons: the cost of keeping its whole history on a third-party platform, owning its records outright, and having a complete backup it controls. None of those was urgent on its own. Together they justified the move, because every year of new inspections made the eventual move larger.

There was a practical problem in front of the archive. Between InventoryBase and the team's Airtable base sat a sync service a freelance developer had started and never finished. It worked most days. When it did not, someone had to notice, find the failed job, and run it again by hand. It kept its own copy of the data it passed through, but not in a form anyone could treat as a backup.

Take over the live work before touching the history

I started with the live sync, even though the archive was the bigger and more visible job.

The new Rails platform first took over everything the old service did: receiving changes from InventoryBase and Airtable, keeping the two in step in both directions, and writing back only the small set of fields the team was allowed to change from Airtable. Once that ran reliably, the old service could be switched off, and its database was imported into the new platform.

The riskiest dependency was gone before the long import began. The new platform had also been handling real daily traffic for a while before it was trusted with the archive.

Every incoming change arrives as a signed webhook and is recorded before it is processed. If processing fails, the event goes to a dead-letter list where it can be inspected and replayed. The old service had no recorded failure and no controlled retry path.

Import one record at a time, and make it resumable

An inspection in InventoryBase is not one record. The import fetched each property with its contacts, meters and photos, and each inspection with its report, report details, contacts and attachments, across 14 inspection types.

It works through the list 50 records per page. For each record it stores the raw response exactly as it arrived, then builds the tidied version the platform works with. The raw copy costs storage. It also means a question about migrated data can be answered from what the source actually sent, long after InventoryBase is gone.

The import only moves its bookmark forward once a record has fully imported. It skips records it has already done, and it leaves the bookmark alone if a record fails. I could stop it, deploy a fix, and start it again without losing work or copying anything twice. Records are matched on InventoryBase's own IDs. A timestamp check stops an older imported value from overwriting a newer change that arrived by webhook in the meantime.

Respect the rate limits

InventoryBase limits how many requests an account can make. The import was paced to stay under that limit. When the API answered with a 429 or a temporary server error, it retried up to four times, waiting as long as the API asked or backing off on its own schedule, and it logged every retry.

The slower historical backfills ran at 40 requests a minute, inside the limit. Airtable needed the same treatment. It allows five requests a second, so the platform pauses between pages and marks a run as partial if Airtable's pagination expires, instead of reporting that the run finished.

Tripping the limit can also lock out people who are trying to work in the same account that morning.

Treat photos as their own migration

Photos were the biggest part of the job: more than 11 million files. They fail differently from records. Some already existed in the agency's older storage and could be adopted by matching their filenames. Others had to be downloaded from InventoryBase. A few matched more than one candidate, and those were reported for a person to check. They were never picked automatically.

Photo work ran on its own queues, away from the webhook processing that keeps daily work in sync, so a large download never delayed a live change. I wrote about the split between a read-write bucket and a read-only legacy bucket in Hosting Is a Trust Problem.

Prove it before you delete anything

Before anything could be deleted from InventoryBase, every property was checked against the source: its reports, report details, PDFs, meter readings and photos, each with its own status. Deletion only proceeds in checked batches. So far a few thousand records have been removed.

The checks ran with read-only access and were paced so they would not compete with live traffic. Nothing leaves the old platform until the new one can show it holds everything that record needs.

Keep the live sync and archive work separate

  • Move the live sync first. Once the daily work runs on your platform, the archive can move as background work.
  • Keep the raw data from the source, next to the tidied version.
  • Make every import step resumable, and safe to run twice.
  • Pace requests so they stay under the provider's rate limits.
  • Treat photos and documents as a separate migration, with their own failure modes.
  • Decide what "done" means per record before you start, and check against it before deleting anything.

The platform is live, the team uses it daily, and I still maintain it.