SQL error upgrading 1.5.3 to 2.6.1

I’m having what seems like a variation on a common problem.
I upgraded, fixed files, and got to the upgrade database where I got:

SQL error in migration: Mysqli prepare error: Unknown column 't1.td' in 'where clause'

exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Unknown column 't1.td' in 'where clause'' in /home/siaste/kplma.org/om/application/libraries/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/siaste/kplma.org/om/application/libraries/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('DELETE t1 FROM ...')
#1 /home/siaste/kplma.org/om/application/libraries/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'DELETE t1 FROM ...')
#2 /home/siaste/kplma.org/om/application/libraries/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('DELETE t1 FROM ...')
#3 [internal function]: Zend_Db_Adapter_Abstract->query('DELETE t1 FROM ...')
#4 /home/siaste/kplma.org/om/application/libraries/Omeka/Db.php(80): call_user_func_array(Array, Array)
#5 /home/siaste/kplma.org/om/application/migrations/20120221000000_unEntityTags.php(29): Omeka_Db->__call('query', Array)
#6 /home/siaste/kplma.org/om/application/migrations/20120221000000_unEntityTags.php(29): Omeka_Db->query('DELETE t1 FROM ...')
#7 /home/siaste/kplma.org/om/application/migrations/20120221000000_unEntityTags.php(18): unEntityTags->_updateSchema()
#8 /home/siaste/kplma.org/om/application/libraries/Omeka/Db/Migration/Manager.php(229): unEntityTags->up()
#9 /home/siaste/kplma.org/om/application/libraries/Omeka/Db/Migration/Manager.php(106): Omeka_Db_Migration_Manager->_migrateUp(Object(DateTime))
#10 /home/siaste/kplma.org/om/application/controllers/UpgradeController.php(46): Omeka_Db_Migration_Manager->migrate()
#11 /home/siaste/kplma.org/om/application/libraries/Zend/Controller/Action.php(516): UpgradeController->migrateAction()
#12 /home/siaste/kplma.org/om/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('migrateAction')
#13 /home/siaste/kplma.org/om/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#14 /home/siaste/kplma.org/om/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#15 /home/siaste/kplma.org/om/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#16 /home/siaste/kplma.org/om/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#17 /home/siaste/kplma.org/om/admin/index.php(28): Omeka_Application->run()
#18 {main}

I went back to my database and restored the back up. Same thing.

Suggestions?

Thanks for anything!
Susan

1 Like

I assume you’re actually upgrading to Omeka 2.7, not 2.6.1? This issue was introduced in 2.7.

This is, somewhat embarrassingly, a typo. The error message mentions t1.td on line 27 of application/migrations/20120221000000_unEntityTags.php, which is supposed to be t1.id instead.

You can make that one-letter change yourself, or you can apply a patch that does the same thing, if you’re comfortable with that. After fixing the typo, if you restore your backup and try again you should no longer have this issue. We’ll also have a release out in the future that includes this fix.

1 Like

Yes, 2.7.
I was able to make the change, and all is well.
Thank you!

I’m so glad you asked this question, Susan, as I had the same issue yesterday when upgrading to 2.7.

The fix that jflatnes suggested worked perfectly for me – once I edited the .php file in question, I was able to complete the upgrade successfully.