mysterioustrousers / MTMigration

Manages blocks of code that only need to run once on version updates in iOS apps.
BSD 2-Clause "Simplified" License
914 stars 50 forks source link

From which version is not specified #17

Open oonoo opened 10 years ago

oonoo commented 10 years ago

If i need to migrate from lets say 1.0 to 1.1 and i would use your method migrateToVersion:block: with the parameter @"1.1" for the version, than the block would be executed if the current Version is 1.1 no matter if there was an old version installed. And the block would get executed if the app version is higher. For example if the initial install of the user is 2.0 than the block would get executed.

Please correct me if i am wrong.

Best regards.

pwightman commented 10 years ago

Hi @oonoo,

If i need to migrate from lets say 1.0 to 1.1 and i would use your method migrateToVersion:block: with the parameter @"1.1" for the version, than the block would be executed if the current Version is 1.1 no matter if there was an old version installed.

Yes, migrateToVersion:@"1.1" block: would run once (and only once) for every device if your new version number was @"1.1" (or higher). It doesn't care how the device got to that version (whether by new install, update, etc.)

And the block would get executed if the app version is higher. For example if the initial install of the user is 2.0 than the block would get executed.

Yes, this is also true, I think README states that all un-migrated blocks in-between version numbers will be run.

I can see how this behavior might be undesirable in certain situations, so if this conflicts with a use case you have, I'd like to hear it to get a better idea of the migration situations people are having. For example, I've thought to add a migrateFromVersion:block that runs once (and only once) if they updated from a particular version instead of to a version. So like if a bug was introduced in 1.1, then you'd use migrateFromVersion:block since other versions shouldn't be affected.

revolter commented 9 years ago

@pwightman, I think it shouldn't run migration blocks at all if their target version is lower that the current app's version.

revolter commented 8 years ago

@pwightman, Any news with the migrateFromVersion:block method?