How to rename an existing column in a data table?

I have a live iOS app that displays videos. On Backendless, I have a data table named “Video” with a column named “videoDescription”. I want to rename “videoDescription” to “caption” without losing any of my existing data. How do I do that?

Hi Joseph,

It is very easy. Please see the video at the link below which shows how to do it:
https://monosnap.com/file/KtwiyPY4gTgXRiCVuaSSSJsM91NVMT

Regards,
Mark

Thanks for your reply, but I don’t think it quite addresses what I am trying to understand. I realize you can change the column name in that way. My concern is changing the column name after the app has already been deployed given the following realities:

    The iOS app currently in the App Store has a property on the Video object with the old name. The Backendless SDK seems to automatically use the property name as the way of knowing which column to set or create. So, if I change the column name on the Backendless console, and the existing iOS app adds a Video record with the old property name, it will just recreate the column with the old name.
I want to know how to change the column name in such a way that even deployed versions of the iOS app with the old property name map to the new column name. That is, when a new Video is created on the iOS app using the old property name, the data for that property shows up in the column with the new name.

In your code you have classes which have the same structure as the corresponding data tables - a property name in the class is mapped to a column name. If you change the name of a column and do not make a corresponding change in the app, then the code will simply “miss” the data represented by the column.

This is the default behavior of the system. It can be overridden using custom business logic (Cloud Code). Suppose the column name changes from “videoDescription” to “caption”. Using custom business logic you can “revert” the column name back to “videoDescription” in the responses which will be sent back to the client. For example, in the “afterFind” API event handler you would get the value of the “caption” property and replicate it in the “videoDescription” property, thus the client will not see the difference.

Likewise, a similar change would need to be made if your client app allows to update video descriptions. The client app will send an object to the server where the description is represented by the “videoDescription” property. In the “beforeUpdate” API event handler, you would do take the value and substitute the property with “caption”.

Hope this makes sense. To read more about event handlers, please see the doc:
JS business logic:
https://backendless.com/documentation/business-logic/js/bl_event_handlers.htm

Java business logic:
https://backendless.com/documentation/business-logic/java/bl_event_handlers.htm

Regards,
Mark

This is very helpful thank you!!! I think this is exactly what I was looking for! Looking forward to your thoughts on my reply to another (unrelated) answer you posted!! (http://support.backendless.com/t/tabe-joins#comment-27597)