I'd like to change existing contents type's machine name, but apparently it is not an easy task.
I've changed all machine name values in DB (type and bundle in node_ tables, along with config and key values....), but it did not work. Seems like the original machine anme is stored in somewhere, like key value's json key. I stopped pursuing any further, after a few hours of googling. Seems like nobody recommends that.
So, I've tried to migrate all contents to another contents type, but below two approaches so far have not been fruitful.
1. Migration tool + plus + custom module for yml -> run command line migration w/ yaml configuration -> I don't know why, but I cannot make drush command for migrate to find my yaml file. Where should I store that file?
2. I've tried with View Bulk Operations and edit sub-module, but it does not seem to support contents type change natively. I tried to create a custom module to add the function, but I cannot make it available in views -> thus to Mange -> Content
There might be a way to download all files and upload them back to the website, but I cannot find relevant information that helps me to keep it as close as changing in database's machine name. All instruction manuals that I can find sorta pushes me to practically the same as re-creation of everything, without keeping my custom added values like extra author, file (image), date/time, and etc.
I prefer to manipulate with DB, as long as it gives me feasible solution, but I am willing to explore.
Comments
You might be able to export
You might be able to export the config files and change the names in them and then re-import them. Or you might be able to run search-and-replace db queries but those might not work if serialization is involved. Or you could write a script to load everything in the db, change names, and write it back.
But, it's probably going to be easier to just do a migration. You can export your data to JSON using views (including custom fields, image paths, etc) and then migrate them in.
This shows how I structured it: https://github.com/TolstoyDotCom/migrate_json_test I should add a note that it expects the module to be in the modules/custom directory.
Available for paid support, module development, migrations, consulting...