Open-AudIT
https://www.open-audit.org/phpBB3/

[HELP] Upgrade to database 1.12.8 Fails with Error
https://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=6551
Page 2 of 2

Author:  Vargas77 [ Tue Sep 20, 2016 9:57 pm ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

Hello,
sorry for late answer.
Got new error on OAE-Linux-x86_64-release_1.12.8.2.1.run (upgrade from 1.12.6) database upgrade.

A Database Error Occurred
Error Number: 1054
Unknown column 'oa_user.user_full_name' in 'field list'
/* M_oa_config::load_config */ SELECT oa_config.*, oa_user.user_full_name FROM oa_config LEFT JOIN oa_user ON oa_config.config_edited_by = oa_user.user_id
Filename: models/m_oa_config.php
Line Number: 108


Please see attachment (database copy without data)

Attachments:
openaudit_no_data.sql.tar.gz [6.73 KiB]
Downloaded 495 times

Author:  jpa [ Wed Sep 21, 2016 2:48 am ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

You'll get this error if your oa_config.internal_version is less than 20160409 but the oa_user table has had it's schema updated with new field names.

What value do you have in oa_config.internal_version?

Author:  Vargas77 [ Wed Sep 21, 2016 11:47 pm ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

Yes you are right:
internal_version 20150620
What should i do?

Author:  jpa [ Thu Sep 22, 2016 1:25 am ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

That is a difficult question as we don't know what state of upgrade your database is at right now. It's hard to fix a database where the upgrade routine broke mid-way. It's usually easiest to roll back to a backup, fix the upgrade routine and try upgrading up again. If you had support Opmantek would handle it for you.

What is your oa_config.display_version? internal_version "20150620" is display_version 1.8.2.

I would step through the SQL statements in the upgrade routine at line 3587 of application\controllers\admin.php and try to see where it stopped. Line 3749 is where the database internal_version is updated. Somewhere between 3587 and 3749 it stopped updating. You can compare your current schema against these to see where it stopped. For example line 3741 is "ALTER TABLE oa_group_sys DROP group_sys_type" so if your table oa_group_sys has a group_sys_type column then you know this step wasn't done.

Author:  Vargas77 [ Thu Sep 22, 2016 3:46 pm ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

Hello,
i have backup of machine with 1.12.6. Many time tried upgrade it to 1.2.8 to 1.2.8.1 (with sql_update from wiki), to 1.12.8.2. Always was error on DB upgrade (not same but ...)
In this time what is better way to upgrade from 1.12.6 to 1.12.8.x?

Author:  jpa [ Fri Sep 23, 2016 1:42 am ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

Roll back to 1.12.6 and then try to upgrade to the latest v1.12.8.2.1.

I don't know if this will fix it but earlier in the thread Mark (developer) indicated he had a customer with the same problem and found a fix for the next release. I don't know if that is in v1.12.8.2.1 but you can try and see what happens.

Author:  Mark [ Thu Sep 29, 2016 8:36 am ]
Post subject:  Re: [HELP] Upgrade to database 1.12.8 Fails with Error

The fix will be in our next release. It's caused by having bad data in some of the tables. The system_id in the table is set to an id that doesn't exist in the system table. Any supported customers that have reported this have received a fix or direct help from me (as in a screen sharing session where I have fixed it for them). We give great support but you can understand we can't do this for free. That's a benefit of being a supported customer :-) If you're not a supported customer and not willing to become one and your database has bad data, I'm afraid you'll need to wait until the next release. Apologies.

Now having said that, I'll post the fix / code patch here but leave it to you to work it out for yourself.

[code] $tables = array('audit_log', 'bios', 'change_log', 'disk', 'dns', 'graph', 'ip', 'log', 'memory', 'module', 'monitor', 'motherboard', 'netstat', 'network', 'oa_group_sys', 'optical', 'pagefile', 'partition', 'print_queue', 'processor', 'route', 'san', 'scsi', 'server', 'server_item', 'service', 'share', 'software', 'software_key', 'sound', 'sys_man_additional_fields_data', 'sys_man_attachment', 'sys_man_notes', 'task', 'user', 'user_group', 'variable', 'video', 'vm', 'warranty', 'windows');
foreach ($tables as $table) {
if ($this->db->field_exists('system_id', $table)) {
$sql[] = "DELETE FROM `" . $table . "` WHERE `" . $table . "`.`system_id` NOT IN (SELECT system.id FROM system)";
}
}[/code]

Page 2 of 2 All times are UTC + 10 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/