Renaming a Content Type Machine Name I have a really annoying typo right through my Drupal install (db table names, modules...you name it it's right through). Ideally I would like to fix the typo and not recreate the content type/modules etc.

The process I have gone through so far:

Find/replace all instances of the typo in the Database using this Script https://gist.github.com/leewoodman/9544808

I then renamed all the tables where the typo occurred using this:

RENAME TABLE field_data_field_accomodation_ref TO field_data_field_accommodation_ref,  field_data_field_offer_accomodation TO field_data_field_offer_accommodation, field_revision_field_accomodation_ref TO field_revision_field_accommodation_ref, field_revision_field_offer_accomodation TO field_revision_field_offer_accommodation;

Then I ran this ruby script to replace all instances of the typo in my files/file/folder structure: https://gist.github.com/dvdsgl/4600317

Then I deleted all caches manually in the DB using:

SELECT
  CONCAT('TRUNCATE TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';') AS table_name
FROM information_schema.TABLES
  WHERE TABLE_SCHEMA = 'my-db-name'
    AND TABLE_NAME LIKE 'cache_%'
    AND TABLE_TYPE = 'BASE TABLE'


I am pretty confident I fixed all the typos but I then get an entityreference error. 

Am I missing another step here somewhere?
It is impossible to tell whether you've missed something without having complete access to your schema.  The fact that you get an entityreference error after clearing all caches is not a good sign.

A safer approach to renaming a content type machine name is to recreate the bundle with the correct machine name, and then use Node convert to convert it from the old machine name to the new one.


  Node Convert ... gives the ability of converting the node from its current node type to another node type. Also it gives the ability of transfering all the custom CCK field values of the current node type to the destination CCK fields, or discard them. As of 5.x-1.4 you can bulk convert many nodes of the same type, to another one that can be accessed in Administer → Content → Convert Nodes.


It allows both single node a and multiple node conversion. Here is a link to the documentation.

I've used the module for a similar use case as yours, with success.