plugin to alter table change column name and update schema

By kitsguru - September 3, 2021

I want to write a plugin that will rename a column and update the schema.

I found code to add a column but not sure how to rename a column and update the schema accordingly.

I have many clients using the same code base and when I upgrade to a newer version of my app, I need to ensure the columns are renamed so I don't lose any data.

When I update the client to the new app with the new schema, the old schema is replaced. When logging into admin, the new column names are created and the old column names have no label. I guess my plugin could just copy the data from the old column to the new and then remove the old column.

What I would like to happen is the column is simply renamed.

Any suggestions would be helpful.

Jeff Shields