Changing Doctype names and field names


When i change doctype names and field names , new doctype(new tables) and new fields are created.
The older doctypes,tables are there. The older fields(columns) are there when i change field names.

I deleted old doctyes, dropped old columns from mysql. deleted folders in doctype folder.
after that updated the app in production.

But the columns and doctypes are still present in production. so i removed them in the same way.

Is it the way its supposed to be done or have i done anything in the wrong way?

Yeah, tables are not automatically deleted for safety. You will have to delete them manually.

Hello Rmehta,
Does this mean you can rename the doctypes without breaking the system?

I’ve personally tried renaming the doctypes I made and it works. But just to be safe, don’t rename the erpnext built in doctypes. :slight_smile:

1 Like

Me too tried. Worked for me. We need to change the folder names and class names also.

Is it safe to delete unused columns from the database after deleting docfields ?


It’s not really recommended but if ta columns were never used and they don’t contain any necessary data, then you can try it.

However, if you “renamed” the docfield (eg changed c-name to customer_name through the UI), then you’d be better off creating a script that checks if the unused columns still have important data stored inside them and manually transfer the data from the old column to the new one (while deleting the data in the unused columns).

1 Like