
So, if you add a column as part of an update, add it in the create statement inside the onCreate function (for new users) and as an alter statement inside the onUpgrade function (for existing users).ĭo you know of an even better way to handle Android SQLite database migrations? Send us your technique and if we agree, we will add it to this guide. To run the app from android studio, open one of your projects activity files and click Run icon from the toolbar. SQLite Database is an open-source database provided in Android which is used to store data inside the users device in the form of a Text file. One other thing to keep in mind is that you will also want to alter your create statements that are run inside the onCreate function. No matter what previous version was and regardless of what more recent version they upgrade to, the app will run the proper statements to take the app from the older schema to the properly upgraded one. Now the app will iterate over the update statements and run any that are needed. Public class SQLiteHelper extends SQLiteOpenHelper
