Correct way to handle old versions of mobile app when database schema changes

I have an ionic android mobile app that connects to ruby ​​on rails api server and this app uses postgresql as database server.

whenever i create a new function i deploy both the api and the new app to the app store and push the respective api and app versions that have their own versioning sequence.
The api is deployed to the server, but the app on user devices is not updated frequently, so below 2 cases arise for me.

Case 1: Adding new columns
The problem occurs for release when, for example, I have several new columns added to certain tables in the db to capture additional information for which the corresponding text boxes have also been added to the application UI.
Here users of the new version of the app will work as expected (send these 2 information to the columns), but the older versions will not send these 2 field values

Case 2: Deleted columns
for example, I am rebuilding the application in the main and have to normalize the database as it was previously inefficient, which even results in table splitting etc. or deleting multiple columns.
Here, older versions of the app just crash or crash.

I feel like every business application I build will have the same script to manage and this should be a common problem for everyone

I am writing some custom logic where the app will check when connected to the api server for the " update flag " and if the app version is set to update to make it work with the api version then the app will be redirected to the play / app store.

I would love to know how everyone deals with this problem and I am doing the right way.

Is there any rails plugin or library out there that already tackles this specific issue? or helps with this. I know there are many versions available but they don't care about this issue [force app update]

Please direct

+3


source to share


1 answer


I was working on a project where the config API was called in Android App Startup. This API will provide 2 fields: major_version

and minor_version

. If major_version

the configuration from the API does not match the one in the application, a pop-up window will appear asking you to force the application to update. This will be on the startup screen, so you won't be able to access the actual content of the app unless you force the app to update. If you don't need a force update between two app versions or two API versions, you have the option to customize minor_version

.



0


source







All Articles