sarunw
sarunw

Reputation: 8176

Backup/restore sqlite file for Core data with Dropbox

I'd like to implement a backup and restore feature in a sql-backed Core Data app. I can successfully backup and restore .sqlite file via dropbox, but I have one question about this approach.

If, in the future, my data model changed there are 2 possibles case that will happen.

  1. User backup in newer version and restore it in the older version of my app. From my understanding that will cause some schema error.
  2. User backup in older version and restore it in the newer one. I think this one will work just fine because it should migrate as normal case.

If this assumption are right, what should I do to handle the problem that may occur from the first case?

Upvotes: 4

Views: 1519

Answers (1)

thom_ek
thom_ek

Reputation: 671

  1. When I make backup I create it as zip file containing plist file with stored version of backup in it. When I do restore I check that version and if backup is newer than current version I deny restore. It doesn't make sense to restore backup in older app version.
  2. As long as You have necessary models it will work properly.

Upvotes: 1

Related Questions