Field Types Trick when Upgrading ExpressionEngine from 2.x to 6.x

It might seem daunting but it's easier than you think!

Upgrading an ExpressionEngine website from version 2.x to version 6.x may seem like a big jump but the ExpressionEngine 6 installer is surprisingly good and jumps through the upgrade process quite smoothly.

However, there's always a "gotcha" and this is usually related to add-ons and field types.

The ExpresionEngine guide specifies that add-ons should be uninstalled before the upgrade and then replaced with the latest versions afterwards. This is OK but be careful with field types!

If you uninstall third-party fieldtypes (such as Wygwam) you will loose the data that the fieldtypes manage.

For many third-party field types, the data is stored in the database table called exp_channel_data and when a fieldtype is uninstalled it will delete the column in that table which contains its data.

If you're struggling to upgrade, and it's because an old fieldtype is causing a problem, a handy trick is to change the type of field that is managing the data and then change it back after the upgrade.

The fieldtypes (in EE2) are configured in the database table called exp_channel_fields. Using your favourite database management tool (MySQL Workbench is a good one, or PHPMyAdmin if you're working on your webserver) open up the exp_channel_fields table and look down the column named field_type. In there you'll see which fieldtypes are managing which data in the exp_channel_data table.

Make a note of any that are managed by fieldtypes that you're going to remove before upgrading and then change their field_type to "text" and save your changes. This will preserve your data when performing the upgrade.

After the upgrade is finished - install your latest add-ons and field types and then go back to the exp_channel_fields table and rename those fields back to their original fieldtype names.

Your old data should now be preserved and will re-appear.

This doesn't work if the fieldtype uses its own table for data storage, but for most cases this trick could get you out of a situation where an old fieldtype prevents the upgrade from working smoothly.

Merlin engine logo

The data revolution is here.

Merlin THE API builder for developers. Test it now

Get VIP access