Hi,
I am trying to run a repeating migration and unfortunately the source data does not have an accurate timestamp for when records get changed (why oh why?). Anyway I am keeping track of the relevant data and only want to update records where they have changed. I have taken a similar approach to what the feeds module does in that I am storing an md5 hash of the relevant fields in the destination content type and then returning 'false' at the end of prepareRow() for values which already have identical values in the database, resulting in these rows being skipped. I however don't want to skip these rows but rather just mark them as 'needs_update' in the migrate map, and I can't work out the way to do this.
I hope this is enough information to go on.
Cheers and thanks for a great module.
K
Comments
Comment #1
mikeryanIf the source key for the row is $row->id, then do:
Comment #3
joachim CreditAttribution: joachim commentedWhere can that be set?
MigrateSource::next() checks for this before prepareRow() is called.
Comment #4
mikeryanA migration step based on MigrationBase is how I've done this before. In that case, the entities in question didn't have update timestamps, but there was a transaction log, so I implemented a class that ran first which processed the transaction log, deleting anything with a DELETE transaction and setting needs_update to 1 for anything with an UPDATE transaction.
Hope this helps.
Comment #5
joachim CreditAttribution: joachim commentedCould the order of things in MigrateSource be changed so this could be set in prepareRow()? It would be much easier that way!
Comment #6
mikeryanTough to say, without trying it, whether it would break anything else. Patches welcome...
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #8
joachim CreditAttribution: joachim commentedCould we set this to postponed please?
If mikeryan reckons it might break things, we could perhaps make this change when it's time for a new major version?
This may also turn out to be needed when processing entities with #1883112: Migrate SourceEntity? .
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedSure - sorry about that! I was just cleaning up some of the queue for Mike yesterday. I'll leave this one alone :)
Comment #10
13rac1 CreditAttribution: 13rac1 commentedIf we are going to leave this open, can someone explain why setting needs_update=1 or using track_changes won't fix OP's issue?
Comment #11
mikeryantrack_changes didn't exist at the time of the original issue. I think it obviates the need for any more here...