Skip to content

SoftDeletes in LegacyTransfer

Sam Sehnert requested to merge legacy-migration-refinemetns into master

I found that legacy migrations weren't transferring deleted records. This is because the "withTrashed" method is actually a macro on the builder which is invoked by __call, so our check method_exists($legacyModel, 'withTrashed') was never actually working, and we were only getting active records.

What I did:

  • Improved the way soft deletes are detected.
  • Improved the recorded timestamp for soft deleted migrations.

Testing:

  • Migrate a model which uses legacy soft deletes and ensure deleted records get transferred
  • Check that the timestamp matches the last updated timestamp from Zon

Merge request reports