2

I have a couple of channels where I need to fit in more text than what EE natively allows. I was able to figure out how to change these fields from Text to Mediumtext, but when I upgraded from EE 1 to EE 2 those fields were reverted to Text and data lost. Fortunately, I was able to restore the missing data after redoing the edits, but I am wonder if there's any way to tell in advance when this will be an issue on an upgrade? Are field lengths reverted only on major version upgrades, for example?

I am also wondering if there are any add-ons available for handling such edits, should I need to redo them with each upgrade?

2 Answers 2

4

I believe the issue is only presented on major updates. EE2 changed the database structure of EE, including changing database table names, adding new tables and then repopulating them with data.

Generally, updates may add or delete fields (data columns), but don't do much to existing fields. We had modified a few fields size to MEDIUMTEXT and one or two to LONGTEXT for different clients and had the same issue with the EE2 upgrade, but no prior issues before that.

I think generally speaking, almost anything that is an update may contain minor database changes, but won't revert basic fields. Upgrades though can be a different beast. Ellis Lab was pretty good throughout all of 1.x to 1.7.3. I recall making the database modifications in the early days of EE1 and not a single problem until the upgrade to EE2.

Hindsight being 20/20, I of course realized that the database structure would be changed in EE2, I had just forgotten that I had modified the database myself before. But that's why backups are very important.

Truth is, in a major update such as EE2, I wouldn't have wanted to adjust all the INSERTS and ALTERS at the code level anyway, for fear that I would overlook something. So our process for clients was to backup, restore current database to our development server, then upgrade. Our original plans included running Navicat to compare the databases, but with the names of tables changing etc. that didn't really work. We ended up printing out table structure from old and new then modifying the new. This then required an INSERT of the fields data again, but worked.

To the best of my knowledge, I've never heard of any add-ons that would help for this situation. Any solution would need to be able to scan the update/upgrade files for specified database changes, but since EE is "shutdown" during the upgrade, I'm not certain if an add-on would work.

The Release Notes/Change Log for updates contains quite a bit of information that can be helpful in planning for the upgrade as well.

I think for most updates, it's not a worry. For major updates, I'd be concerned. But a quick look at the update file, from the system/installer/updates/ folder would tell you if the database is being altered.

3
  • I wanted to provide an update on this issue. I just upgraded to 2.7.0 from 2.5.3 and it seems that now the fields are reset to text even when it isn't a major version upgrade. I will have to look at what needs changing in the update script to avoid this happening in the future, I think. Aug 30, 2013 at 7:59
  • While 2.7.0 isn't consider a major release in terms of Ellis Labs numbering scheme, it definitely is in terms of everything else. From what I understand they made a number of database changes to add the new Grid field type. A number of third party vendors add-ons were broken, as well. Which qualifies it as a major update. Ellis Lab started preparing people for it back at the beginning of August: ellislab.com/blog/entry/…. So while not the difference between 1.6.x to 2.x, it requires database changes, which means database resets. Sep 7, 2013 at 17:37
  • Whenever the update modifies the database, fields will be reset, unless you re specify before updating. 2.7.x introduce a total rewrite of how relationships were handled, so plenty of database changes. It's not a minor upgrade, despite the point reference. Jan 9, 2014 at 7:33
1

First things first:

  • EE --> Admin --> Channels --> Channel fields
  • Choose the Channel field group you'd like to change.
  • Select the field you'd like to change.
  • Change the field type to Text input
  • Adjust the maxlength to the value you'd like.

If that's not what you're looking for (you've tried it but still need more characters/ space) than it's time to dive into the database.

I would suggest using PHPMyAdmin. You're looking for exp_channel_data. Change the datatype of the custom field to whatever you like. Check http://dev.mysql.com/doc/refman/5.1/en/blob.html for a full reference on datatypes. If you know the id of the custom field it's really simple to find. Just look for field_id_7 if your custum field id is 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.