Updating database with Sqlite.net Pcl for Xamarin android
You have to remember that CreateTable is already doing the column updates for you because internally it calls the MigrateTable method, which you can see here for further clarification: https://github.com/praeclarum/sqlite-net/blob/master/src/ SQLite.cs # L562 .
However, you may need to handle more complex changes to your database, such as adding triggers or something similar. In this case, I suggest that you make the changes manually.
In Xamarin Forms I ended up with this: https://gist.github.com/matpag/b2545cc22c8e22449cd7eaf6b4910396
May not be the best strategy ever, but seems to work for me.
To summarize :
You must store the version of the database in an internal SQlite database flag called user_version, accessible with the PRAGMA keyword. Every time you get a database connection, you need to check and see if the current version of the database is the same as the latest version of the application database. If not, you need to update the database and install the new current version.
source to share
This is not a script question, as it doesn't. You can release a "patch" version that will run once by fetching all your records into a temporary form โ deleting the table โ creating it again (assuring it to create new columns, etc.) โ re-inserting the record again. After a while, when you know that all of your users (or when you set the limit) have moved to a newer version, you can simply remove the "patch" from your code.
Hope it helps.
source to share