With Drupal 7 we had the Field Rename module, but this has not yet been ported to Drupal.
So what SQL magic is needed to rename a field in Drupal 8?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
I've had the misfortune to need to do this before :P , and my advice would be as follows:
Forget about renaming the existing field; the machine name is scattered across several different hard-to-edit places, and you'll probably miss some and get weird errors. For example, if you just rename the tables and the configuration, the field API will throw a fit when it tries to delete the old tables and finds they're already gone. The schema information is kept in the keyvalue store, and cannot be rebuilt from scratch, so if you make manual changes it's easy to end up in a broken state.
Instead, recreate the field with the correct machine name, then copy over the data with SQL, and finally delete the old field.
INSERT INTO node__field_new SELECT * FROM node__field_old; INSERT INTO node_revision__field_new SELECT * FROM node_revision__field_old;
Regarding the latest comment from StevanRS, its not simply than that, because if you just import after renaming, it will fail because original field will not exist anymore. So, here is my proposal:
Tipical files you need to save: