Search code examples
ioscore-datacore-data-migration

Do inferred mapping models always result in lightweight migrations?


We've had a few cases of our App seemingly having trouble migrating user data when an inferred mapping model has been used. The App has needed too long to complete the migration and the migration has failed. Yes – we shouldn't be migrating during launch!

I'd like to know if it's possible that an inferred mapping model might not result in a lightweight migration. All the accounts I've read suggest that inferred mappings are necessarily lightweight, but I've not seen a strong statement that this is a guarantee.

The situation where we've had a problem included a property being deleted from the schema which was stored as external binary data (Allows External Storage was ticked in the schema editor). I wondered if this particular migration, with its model inferred automatically, might still require a heavy migration where the whole database is drawn in to memory.

Is there a way to tell if a specific inferred migration is heavy weight?


Solution

  • Unless you yourself define a custom mapping model, the migration is by definition lightweight. This is the only possible interpretation of the definitions of "lightweight" and "custom" migration in the documentation.

    This is independent from the migration failures you have seen. Maybe some changes necessitate a custom migration which is why the lightweight migration fails.