Migration
Leaving Asana without losing anyone's work
Imports get run twice, old projects keep emailing people, and a shutdown can die halfway. The migration tooling grew out of each of those.
The problem
The plan was to move every client project from Asana into the platform's own task system and then stop paying for Asana. A teammate wrote the original roadmap in February 2026. I built the tooling that does the move.
A move like this fails in ways that are not obvious. Imports get run twice. Old projects keep emailing people after they have moved. A shutdown step times out halfway and leaves a project half processed.
This is only about Asana. Freshdesk was replaced differently, with no ticket import, and that is a separate story.
Preview first
Every import previews first. A dry run is the default in both the command-line tool and the admin page, so the person sees what would be created before anything is written. Writing is the thing you have to ask for.
The first version, in April 2026, was a command-line importer built to be run repeatedly. The admin page followed in June and shows the same preview before any write.
A stable identity, in three attempts
Each imported task needs an identity that survives a re-run, so the second run updates instead of duplicating. On one project the first import created 139 tasks, 130 subtasks, 25 comments and 37 attachment links. A second run created none.
The first identity was a hidden marker in the task description. It needed no schema change, and a user could delete it by editing the description. The second was a mapping table that only the system can write.
-- One row per imported task: which source task it came from.
CREATE TABLE import_task_links (
organization_id uuid NOT NULL,
client_id uuid NOT NULL,
source_task_id text NOT NULL,
task_id uuid NOT NULL REFERENCES tasks (id) ON DELETE CASCADE,
UNIQUE (organization_id, client_id, source_task_id)
);
-- Only the system can read or write it. A user cannot delete the link
-- the way they could delete a marker hidden in a description.
ALTER TABLE import_task_links ENABLE ROW LEVEL SECURITY;The third attempt fixed a case the table still allowed. In Asana one task can be filed under several projects. The lookup was scoped to one company, so that task was imported once for each. Now the lookup spans the organization: the first import owns the task, and a later import under another company skips it and says so in the preview.
// Earliest link first: the first import owns the source task.
const canonical = new Map<string, Task>();
for (const link of linksOldestFirst) {
const task = tasksById.get(link.taskId);
if (!task) continue; // a deleted duplicate never shadows the survivor
const current = canonical.get(link.sourceTaskId);
// A company re-importing its own project still updates its own rows.
const targetOwnsIt = current?.clientId !== targetClient && task.clientId === targetClient;
if (!current || targetOwnsIt) canonical.set(link.sourceTaskId, task);
}A backup is not the import
What gets imported is a scope someone approved. The backup is everything: a full archive of the project's history plus private copies of every attachment. For one project the import brought in 268 tasks in scope, while the backup captured all 560 tasks and 282 attachments.
A backup counts as proof only after it is downloaded again and re-hashed. Earlier spreadsheet claims that a project was backed up stay visible as context. They never count as proof. In late July that verification moved into a background job.
// Serialize once, then hash and upload these exact bytes.
function sealArchive(snapshot: ProjectSnapshot) {
const bytes = encode(JSON.stringify(snapshot));
return { bytes, size: bytes.length, sha256: hash(bytes) };
}
// Later, on what was read back out of storage:
const readBack = sealBytes(await storage.download(run.archivePath));
if (readBack.sha256 !== run.sha256 || readBack.size !== run.size) {
throw new Error('Backup does not match what was uploaded.');
}Retirement that can be undone
Migrated projects' open tasks kept feeding Asana's daily digest emails. So retiring a project means silencing it, and silencing changes data in a tool people still trust.
- A snapshot of the project is saved before anything in Asana is changed.
- Each task's change is journaled before it is made.
- The shutdown runs as a background workflow that picks up where it stopped.
The last one came from a failure mode. A shutdown could exceed the five-minute request limit and leave a project partly processed.
A restore has to account for every record
One restore reported success having written nothing. Six tasks stayed stripped of their content while the snapshot was marked restored. Success had been defined as no failures, and a run that does nothing has no failures.
// "No failures" is not enough. Every record must be accounted for.
function everyRecordAccountedFor(result: RestoreResult): boolean {
const accounted =
result.restored + result.moved + result.alreadyCorrect +
result.skipped + result.failures.length;
return result.failures.length === 0 && accounted === result.expected;
}Now every record a restore is handed has to land in one of those counts, and the counts are saved on every attempt. The same change added a guard against two runs working on one project at once.
What the record shows
- The migration tracker listed 129 projects to move, 127 matched to clients.
- One project had 731 top-level tasks.
- A wrong project link on one client's row was caught before import.
What I can't tell you from the record: these figures come from testing and review. The repo does not record how many projects were moved in production, or whether Asana was fully retired and the subscription cancelled.