3

I’m attempting to upgrade from 2.1.3 to 2.9 (I realize this should have been done before now; just took over this site recently). The upgrade fails at 2.5.5 with the following error:

Error Number: 1054

Unknown column ‘protect_javascript’ in ‘field list’

UPDATE exp_templates SET template_id = ‘36’, site_id = ‘1’, group_id = ‘10’, >template_name = ‘.client_name’, save_template_file = ‘n’, template_type = ‘webpage’, >template_data = ‘{exp:channel:entries channel=\"projects\" entry_id=\"{embed:project_entry_id}\” limit=\“1\” dynamic=\“off\”}\n\n{work_client}{work_client:title}{/work_client}\n\n{/exp:channel:entries}’, template_notes = ‘’, edit_date = 1405662666, >last_author_id = ‘1’, cache = ‘n’, refresh = ‘0’, no_auth_bounce = ‘’, >enable_http_auth = ‘n’, allow_php = ‘n’, php_parse_location = ‘o’, hits = ‘0’, >protect_javascript = NULL WHERE site_id = ‘1’ AND template_id = ‘36’

Filename: /home/skeo/webapps/skeo_dev/system/expressionengine/models/template_model.php

Line Number: 389

I tried manually adding a protect_javascript column of type char(1) (guessed based on documentation) but I still get the error. Anyone encountered this? I’ve seen discussion of this happening in other upgrades with other fields but not this one.

  • 1
    I can at least confirm you're not alone on this one, upgrading from 2.6.1 with the same issue. – John Moylan Jul 18 '14 at 9:50
4

For the sake of completeness you can fix this with a simple SQL query to add the required column. See see this official EE thread

| improve this answer | |
  • Thanks. Commented this on an earlier answer but it's good to have this link posted: "I fixed it. Stupid mistake: was looking at the wrong database. Adding the column seems to have done the trick." – Morgan Sep 23 '14 at 12:20
2

Quick dirty nasty fix to get you out of a hole.

EE is was having a problem with the contents of a template when I ran into this.

Go to your exp_templates table and find the offending template. (in your case it's '36')

Remove template data and leave it blank. (obviously store this somewhere for later retrieval)

Run update.

Add your template data back (in CP or in TPL dir) and see what EE complains about.

| improve this answer | |
  • I think my issue was an old Safecracker template, I called this template up in cp after my successful upgrade and added it back in as channel:form and all is happy. – John Moylan Jul 18 '14 at 10:10
  • I also refer you to this line in the 2.9 changelog: The protect_javascript configuration item was removed and turned into a per-template setting. – John Moylan Jul 18 '14 at 10:13
  • I fixed it. Stupid mistake: was looking at the wrong database. Adding the column seems to have done the trick. – Morgan Jul 18 '14 at 17:46
  • removing the template data did not work for me. I added the column to the exp_templates table varchar 11 and it worked for me. – Marc Miller Sep 7 '14 at 1:12
0

Adding protect_javascript to the DB likely won't fix it. There is something in your templates that is throwing the error. BY simply clearing out the data for the specific template in your DB the installer should be able to run just fine.

Here are the steps I took to solve this:

Access the exp_templates table using phpmyadmin or something similar.

Find the rows that correspond to the template ID in the error (I had about 10-12 total errors all related to this). Delete the content that is in the template data field until you no longer get them. Proceed with the installer (i just hit refresh on the installer after clearing the field in phpmyadmin).

Keep in mind, as long as you have a hard copy of your templates somewhere you don't need to worry about saving what is in template data. You can sync that up again later in the CP.

One thing to note, all the templates that through this error in this specific instance were utilizing the old {related_entries} tag pair.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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