Skip to main content
Kiran Brahma
All writing

O9x Build Log 19: The Migration Tax

Part 19 of O9X Build Logs

I spent over three days fighting with the commas in my Excel sheets.

In the past few weeks, I felt that my development of O9X was on solid ground. I decided to start testing it with real company data. As I explained in Log 3, that data is spread across multiple platforms (Google Sheets,Airtable, WhatsApp, Excel, Zoho Books, and payroll software). One of my fundamental goals in building O9X was to organise scattered data in a single location.

I replicated field names across O9X to mirror my payroll software and Zoho Books. I wanted data migration to be a breeze: export data from the old system, save it as a CSV file, and import it. I provided my team with templates on how the data needed to be prepared to avoid any hassles.

My initial plan was to import all data as CSV files. I decided to do a dry run by importing 50 records. My team saved the Excel sheets as CSV files. Two major issues came up after the very first import:

  1. Bank Account Number Details: A lot of bank accounts start with a zero. The payroll software exported all data as Excel files, so zeroes were dropped by Excel. A 16-digit account number became 15 digits. My team found no issues and imported them into O9X.
  2. Column Separation in CSV files: A lot of our text had commas, which broke the column structure when we imported the files. Data landed in the wrong columns, and additional data was just ignored in the import process.

My team noticed no errors when they imported the data. When I decided to do a random check of certain individual records, I could see that my import process was screwed up. The two errors were so simple that I laugh at my own naivety.

There was no need to build a complex tool to fix the issues. When the file is created by my payroll software,my team just has to tag the account column as text, not numbers. I included support for Excel files in my import tool, avoiding the comma issues.

Every time I felt I had resolved all possible edge cases, new ones kept popping up. I fixed around 30-odd errors before the first batch of 50 records was replicated without any errors. The errors were mostly around how data was saved in my current system and how O9X expected it. I spent three days resolving every small error before I was confident in the tool's reliability.

Every time I told AI of a new error, it kept suggesting modifications to my database schema. A few changes were needed, but I ignored most of the suggestions. I was aware that every small change in my database schema would break something in another part of my code. I had already corrupted an older database, so I could not afford to repeat the same error.

Before applying any schema change, I used AI in a separate session to see how the change would impact my code elsewhere and score the risk on a scale of 1 to 10. I asked AI for alternatives when the risk score was more than five. The audit by another agent ensured I did not make a mess of my codebase.

The most common error was Row Level Security. The AI, in an effort to resolve the import issues, kept suggesting changes that would modify the access restrictions for users. In one instance, the first agent suggested a change that exposed a read API to all users. Luckily, I had already put in place a server-side restriction to block unauthorised API calls, but I could not risk such a security issue. The tests I had put in place wouldn't trigger any errors. Hence, I asked the second agent to also audit and rewrite my tests after every change.

In the past two weeks, I started committing after every small change. Previously, I would commit after completing the entire day's work. I realised that if something broke in the middle of a long session, I would be forced to start again from scratch.

Most of my business data has now been imported into O9X. My team has not highlighted any data errors. A lot of work in my app is still pending, so it is still early days for O9X. I expected data migration to be a walk in the park, but it consumed far more time than I originally planned.