Db error upgrading from 2.4.3 to 2.4.8

Hi,
I’m using the patch method to upgrade from ojs 2.4.3 to 2.4.6.
When running tools/upgrade.php I get the following error:
ojs2: DB Error: Unknown column ‘domain’ in ‘field list’

However, the ‘domain’ field does exist in the institutional_subscriptions table.
Can someone suggest where I should begin looking for the source of this error?
Many thanks.

Are you going to 2.4.6, or to 2.4.8? Between 2.4.3 and either 2.4.6 or 2.4.8, the most likely addition of the domain column is in the sessions table.

Can you try the “Full Package” install rather than the patch install with a fresh copy of the database to see if that makes a difference?

Hi,
Thanks indeed for the reply. And sorry for the mismatch between subject and description… I am upgrading to 2.4.6 (not 2.4.8) I tried as you suggest: set up a fresh install from the full distribution and ran upgrade.php against a new copy of the database, but unfortunately the result was exactly the same.

Can you post the full output of the update.php script? That is, at which stage does the error appear?

In the failed upgrade, does your sessions table have the domain column?

I’m afraid the output is pretty terse. This is the entire output from upgrade.php :

[elt@ejournal ojsfontanustest]$ sudo php tools/upgrade.php upgrade
<h1>DB Error: Unknown column 'domain' in 'field list'</h1>ojs2: DB Error: Unknown column 'domain' in 'field list'
<h1>DB Error: Unknown column 'domain' in 'field list'</h1>ojs2: DB Error: Unknown column 'domain' in 'field list'

There is no domain field in the sessions table:

mysql> explain sessions;
+------------+--------------+------+-----+---------+-------+
| Field      | Type         | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| session_id | varchar(40)  | NO   | PRI | NULL    |       | 
| user_id    | bigint(20)   | YES  | MUL | NULL    |       | 
| ip_address | varchar(39)  | NO   |     | NULL    |       | 
| user_agent | varchar(255) | YES  |     | NULL    |       | 
| created    | bigint(20)   | NO   |     | 0       |       | 
| last_used  | bigint(20)   | NO   |     | 0       |       | 
| remember   | tinyint(4)   | NO   |     | 0       |       | 
| data       | text         | YES  |     | NULL    |       | 
+------------+--------------+------+-----+---------+-------+
8 rows in set (0.00 sec)

What does php tools/upgrade.php check report?

Note that you probably don’t want to sudo the upgrade process as root. This can lead to creating files and directories in your files_dir which are owned by root instead of by your webserver user. You want to run the upgrade process as the webserver user, so better would be something like:
sudo su apache -s /bin/bash -c 'php tools/upgrade.php upgrade'

hmm. Exactly the same thing:
[elt@ejournal ojsfontanustest]$ sudo php tools/upgrade.php check

DB Error: Unknown column 'domain' in 'field list'

ojs2: DB Error: Unknown column 'domain' in 'field list'

DB Error: Unknown column 'domain' in 'field list'

ojs2: DB Error: Unknown column 'domain' in 'field list'

Can you try turning on the following options in config.inc.php and rerunning the upgrade check?

; Display a stack trace when a fatal error occurs.
; Note that this may expose private information and should be disabled
; for any production system.
show_stacktrace = On

; Display an error message when something goes wrong.
display_errors = On

Ok, I set show_stacktrace and display_errors to ‘On’. Output is unchanged:
[elt@ejournal ojsfontanustest]$ sudo php tools/upgrade.php check

DB Error: Unknown column 'domain' in 'field list'

ojs2: DB Error: Unknown column 'domain' in 'field list'

DB Error: Unknown column 'domain' in 'field list'

ojs2: DB Error: Unknown column 'domain' in 'field list'

I can report that the site itself also displays only that error. It displayed only that error before even running upgrade.php.

I just checked information_schema.columns … the only table with a ‘domain’ field is institutional_subscriptions.

I’m at a loss. You would expect to not see the domain column in sessions for 2.4.3, but would expect the column to be added at the time of upgrade to 2.4.6.

You would also expect to see a lot more information in the error message after activating the config.inc.php show_stacktrace option.

whoops. I set the wrong option to on (show_status instead of show_stacktrace). Here is what upgrade.php check reports:
[elt@ejournal ojsfontanustest]$ sudo php tools/upgrade.php check

DB Error: Unknown column 'domain' in 'field list'

Stack Trace:

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionDAO.inc.php line 88
Function: DAO->update("INSERT INTO sessions (session_id, ip_address, user_agent, cr...", Array(8))

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 91
Function: SessionDAO->insertSession(Object(Session))

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 130
Function: SessionManager->SessionManager(Object(SessionDAO), Object(Request))

File: /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 281
Function: SessionManager->getManager()

File: /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 187
Function: Validation->isLoggedIn()

File: /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 293
Function: Validation->isAuthorized(1)

File: /ojscontent/www/test/ojsfontanustest/plugins/generic/backup/BackupPlugin.inc.php line 29
Function: Validation->isSiteAdmin()

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/plugins/PluginRegistry.inc.php line 66
Function: BackupPlugin->register("generic", "plugins/generic/backup")

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/plugins/PluginRegistry.inc.php line 137
Function: PluginRegistry->register("generic", Object(BackupPlugin), "plugins/generic/backup")

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/cliTool/CliTool.inc.php line 64
Function: PluginRegistry->loadCategory("generic")

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 34
Function: CommandLineTool->CommandLineTool(Array(2))

File: /ojscontent/www/test/ojsfontanustest/tools/upgrade.php line 29
Function: UpgradeTool->upgradeTool(Array(2))

File: /ojscontent/www/test/ojsfontanustest/tools/upgrade.php line 33
Function: OJSUpgradeTool->OJSUpgradeTool(Array(2))

ojs2: DB Error: Unknown column 'domain' in 'field list'

DB Error: Unknown column 'domain' in 'field list'

Stack Trace:

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionDAO.inc.php line 119
Function: DAO->update("UPDATE sessions SET user_id = ?, ip_address = ?, ...", Array(9))

File: /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 186
Function: SessionDAO->updateObject(Object(Session))

File: (unknown) line (unknown)
Function: SessionManager->write("5veour344p8nbr5hdq8f03l3i4", "")

ojs2: DB Error: Unknown column 'domain' in 'field list'

Interesting. Try disabling the “Backup” plugin under “Generic Plugins” and then try the upgrade again.

I can’t access the plugins because only the error message is displayed on the site. I updated the database manually as follows:

mysql> select * from plugin_settings where plugin_name = 'backupplugin';
+--------------+--------+------------+--------------+---------------+--------------+
| plugin_name  | locale | journal_id | setting_name | setting_value | setting_type |
+--------------+--------+------------+--------------+---------------+--------------+
| backupplugin |        |          0 | enabled      | 0             | bool         | 
| backupplugin |        |          1 | enabled      | 0             | bool         | 
+--------------+--------+------------+--------------+---------------+--------------+
2 rows in set (0.00 sec)

and reran upgrade.php upgrade. The output appears unchanged:

[elt@ejournal ojsfontanustest]$ sudo php tools/upgrade.php upgrade
<h1>DB Error: Unknown column 'domain' in 'field list'</h1><h4>Stack Trace:</h4>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionDAO.inc.php line 88<br />
<strong>Function:</strong> DAO->update("INSERT INTO sessions
                                (session_id, ip_address, user_agent, cr...", Array(8))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 91<br />
<strong>Function:</strong> SessionDAO->insertSession(Object(Session))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 130<br />
<strong>Function:</strong> SessionManager->SessionManager(Object(SessionDAO), Object(Request))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 281<br />
<strong>Function:</strong> SessionManager->getManager()<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 187<br />
<strong>Function:</strong> Validation->isLoggedIn()<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/classes/security/Validation.inc.php line 293<br />
<strong>Function:</strong> Validation->isAuthorized(1)<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/plugins/generic/backup/BackupPlugin.inc.php line 29<br />
<strong>Function:</strong> Validation->isSiteAdmin()<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/plugins/PluginRegistry.inc.php line 66<br />
<strong>Function:</strong> BackupPlugin->register("generic", "plugins/generic/backup")<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/plugins/PluginRegistry.inc.php line 137<br />
<strong>Function:</strong> PluginRegistry->register("generic", Object(BackupPlugin), "plugins/generic/backup")<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/cliTool/CliTool.inc.php line 64<br />
<strong>Function:</strong> PluginRegistry->loadCategory("generic")<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 34<br />
<strong>Function:</strong> CommandLineTool->CommandLineTool(Array(2))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/tools/upgrade.php line 29<br />
<strong>Function:</strong> UpgradeTool->upgradeTool(Array(2))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/tools/upgrade.php line 33<br />
<strong>Function:</strong> OJSUpgradeTool->OJSUpgradeTool(Array(2))<br />
<br/>
ojs2: DB Error: Unknown column 'domain' in 'field list'
<h1>DB Error: Unknown column 'domain' in 'field list'</h1><h4>Stack Trace:</h4>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionDAO.inc.php line 119<br />
<strong>Function:</strong> DAO->update("UPDATE sessions
                                SET
                                        user_id = ?,
                                        ip_address = ?,
        ...", Array(9))<br />
<br/>
<strong>File:</strong> /ojscontent/www/test/ojsfontanustest/lib/pkp/classes/session/SessionManager.inc.php line 186<br />
<strong>Function:</strong> SessionDAO->updateObject(Object(Session))<br />
<br/>
<strong>File:</strong> (unknown) line (unknown)<br />
<strong>Function:</strong> SessionManager->write("cfpq3j06a8odmmd3nfr9gank73", "")<br />
<br/>
ojs2: DB Error: Unknown column 'domain' in 'field list'

Since you haven’t been able to run the upgrade script successfully, what I would do it replace the OJS files with version 2.4.3 again, then disable the Backup plugin, then replace the OJS files with 2.4.6 again, and re-run the upgrade.

Be sure to keep manual backups of your database when upgrading.

Disabling the Backup plugin before running the upgrade worked.
For the record, it also worked after deleting the file in the cache.

Thanks very much indeed for your speedy help in resolving this. Its hugely appreciated!

@elt, Which file did you remove in the cache folder? can i remove all the files under it? if so does it harm? Appreciate your response.