Method for changing field names

Hi,

Changing field names is not allowed by the editor. But if one really wants to change a field name, what is the best way?

It seems to me that I could use the CLI to “sync out” the app, then carefully replace all instances of the field name in the exported JSON files, and then “sync in” to a new app. But is there a better way?

Thanks for your help.

Best,

Barton

The easiest way is to using the JSON view in the schema editor. But it will not rename the fields, it will delete one field and then delete the other. Meaning that you will loose data.

Thanks, Sebastian. If data loss is not allowed, is my approach (export, edit json, import) the best way?

Yes, it is the best way. What is the reason for the rename? There is also the alternative to give you field a label and rename it in a query script.

The reason for the rename is to bring uniformity to some field names across different schemas.

Can you please describe the field labeling approach you mentioned in a bit more detail, and/or point me to the doc for that?

The question is: Who is your user: If you want to have a uniform field names for your editors you can just use field labels, because this overrides the field name in the UI.

Then at least the UI looks consistent.

Ah, I see what you’re saying.

The request is coming from from our programmers, who are writing an app that consumes JSON, so changing labels won’t work for our purpose.

If we decide to proceed I’ll take the export/edit/import approach. Thanks for your help!

1 Like