Question

In iOS, I've had experience working with local-only SQL, and server-only SQL accessed over PHP.

My question is, the app that I'm planning to write will have a local database and a remote database, which is probably pretty common. I'm planning to basically have the iOS app update from certain tables in the server's database.

My question is: Is there a simple or common way to compare the list of columns in a given table, and copy any that are changed or missing from the server to the local database?

Example, if I had a table full of data, and then added a new column on the server, is there a standard way to have the local iOS database reflect that new column?

The idea that I came up with was start both databases as a blank new database, and then any change I add a new SQL script on the server to update the local DB- then, if the iOS device detects a new database revision it would run the update scripts and anything missing would be added. I was just hoping there would be a better way, as this could get messy.

Was it helpful?

Solution

If you use Sqlite in both sides, which would be a zero risk choice for future development, and if you develop a migration system of your own (check Entity Framework Migrations or https://github.com/mocra/fmdb-migration-manager for ideas), you can simply compare latest migration versions and transfer them accordingly. This would be the wisest choice, in my humble opinion.

OTHER TIPS

You should choose webservice for making updates to your iOS app database with Server database. That will be quite easy and efficient way and also Json and xml libraries are powerful way to parse your data. Let me know if you have further queries!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top