In a Mobile App with Flutter, Suppose I have SQLite table with the following columns (A,B,C), now an update for the Flutter application is needed which will include adding more column to be (A,B,C,D) For the app users that already have data in this database, how to update the structure of the database with migrating the data without having to delete the user's old data?
If you are using sqflite, you have onCreate
/onUpdate
callback parameters during openDatabase()
that allow you handling schema migration between version. There is a full example (adding one table, adding one column) here.
If you are using sqlite3 directly, you can also use the user database version to handle migration.