Upgrade from 2.9.1 to 3.1.1

Upgrade from 2.9.1 to 3.1.1

by Ivan Gorbachev -
Number of replies: 4

Hello everyone! 

I'm trying to upgrade Moodle from 2.9.1 to 3.1.1 version. I get an error:

Debug info: ОШИБКА: column "showtabs" at the table "mdl_glossary_formats" do not exist
LINE 1: UPDATE mdl_glossary_formats SET showtabs = $2 WHERE id = $1
^
UPDATE mdl_glossary_formats SET showtabs = $2 WHERE id = $1
[array (
0 => '1',
1 => 'standard,category,date',
)]
Error code: dmlwriteexception
Stack trace:
  • line 477 of /lib/dml/moodle_database.php: dml_write_exception thrown
  • line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
  • line 1270 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
  • line 1749 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->set_field_select()
  • line 3281 of /mod/glossary/lib.php: call to moodle_database->set_field()
  • line 925 of /mod/glossary/lib.php: call to glossary_set_default_visible_tabs()
  • line 52 of /mod/glossary/settings.php: call to glossary_get_available_formats()
  • line 89 of /lib/classes/plugininfo/mod.php: call to include()
  • line 45 of /admin/settings/plugins.php: call to core\plugininfo\mod->load_settings()
  • line 7279 of /lib/adminlib.php: call to require()
  • line 22 of /admin/upgradesettings.php: call to admin_get_root()
Can you help me, please =)
Average of ratings: -
In reply to Ivan Gorbachev

Re: Upgrade from 2.9.1 to 3.1.1

by Ken Task -
Picture of Particularly helpful Moodlers

Hope you've backed up the DB and that you are using a dev server to test this instead of live production.   Might have to revert back to the 2.9.1 version and try again.

In looking at the debug, it appears the DB is postgres?   If so, that could be the issue.   Can't give you specifics ... don't run postgres but maybe there are others who do that could clarify for you.

Might be related as to how you've acquired the new 3.1.1 code ... the old method or via git?

Git would retain the config.php file and use it for all parameters related to DB ... including DB type, etc.

You might have to check out the config-dist.php file of the 3.1.1 code to see if there is anything related to Postgress specifically or even try using a copy of config-dist.php renamed to config.php (which means you need to archive the original config.php file from the 2.9.1 code) and then manually fill out appropriate variables in the new config.php file.

Got command line access? Think I'd do the upgrade via scripts in /moodlecode/admin/cli/ as they take apache out of the loop and will still report issues and errors.

'spirit of sharing', Ken

In reply to Ivan Gorbachev

Re: Upgrade from 2.9.1 to 3.1.1

by Plamen Vassilev -

The error indicates that mod/glossary/db/install.xml is missing the new field "showtabs" for mdl_glossary_formats table. Seems to me your code is not updated properly and does not entirely match version 3.1.1 instead it still has files from version 2.9.1. The "showtabs" improvement is only present for versions 3.0+ which also indicates your code is not properly updated. Hope this helps.

Average of ratings: Useful (1)
In reply to Plamen Vassilev

Re: Upgrade from 2.9.1 to 3.1.1

by Ken Task -
Picture of Particularly helpful Moodlers

Good catch Plamen! +1 ... and another reason to use git.

Git updates/upgrades updates files that need it, acquires new files not contained in present tracking via git, *and* removes code no longer needed (thus no 'write over' attempts for upgrades that miss removing now junk and confuses the update/upgrade process).

https://docs.moodle.org/31/en/Git_for_Administrators

The trick for OP right now would be to get the current 2.9.x code under git and then, after updating to the highest 2.9.x available, pull the trigger on upgrading from 2.9.highest to 3.1.1.   3.1.1 desired cause it's long term support so it should be worth the trouble. ;)

'spirit of sharing', Ken


In reply to Ivan Gorbachev

Re: Upgrade from 2.9.1 to 3.1.1

by Ivan Gorbachev -

I tried to update also to version 3.0,0. There was the same problem. So I have just added these columns to the database and everything works