a8n: Fix Changeset syncing by not marking newly created changesets as deleted
Created by: mrnugget
The problem: we always wrote a value to the nullable external_deleted_at
column on changesets
. But the syncer that updates the changesets only syncs changesets that have not been marked as deleted. That means: every newly created changeset since the introducing of the external_deleted_at
column has not been synced.
The fix: do not write external_deleted_at
if the value has not been explicitly set. Add a migration that resets all changesets that have been marked as deleted to not deleted.
This is on me. An oversight that I covered with the wrong assertion in the tests. It only popped up after I noticed that changesets weren't synced.
The time.Time{}
value got translated to 0001-12-31 16:07:02-07:52:58 BC
in my database. Does anyone know whether that is stable across timezone configurations on machines? If so, I'd maybe extend the migration to only reset the column WHERE external_deleted_at = '0001-12-31 16:07:02-07:52:58 BC'
. But that's not strictly necessary since even if we reset all deleted timestamps, the next sync run will set them again.