MyBB Community Forums

Full Version: Upgrade 1.2.14 -> 1.6.1 Missing Db changes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I found a few changes in the Db to be missing in the upgrade script from version 1.2.12+
So far I ran into problems with the tables
mybb_moderators
mybb_threads and
mybb_adminoptions

Forgive me if I'm wrong but I could not find the missing fields anywhere in the upgrade scripts (I did a fgrep -r on the install directory).

I solved the issue by adding this to the function upgrade12_dbchanges_user in resources/upgrade12.php
(The place is random, I guess it could be put anywhere else as well)

$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators 
  CHANGE `uid` `id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' ");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."moderators 
  ADD `isgroup` INT( 1 ) NOT NULL DEFAULT '0' AFTER `id` ");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."threads 
  ADD loginattempts int unsigned NOT NULL default '0' ");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."adminoptions 
  ADD `loginlockoutexpiry` INT NOT NULL DEFAULT '0' ");

Maybe there's more, but so far the rest looks OK to me.
1.2.12 is many years old...
If you've uploaded files completely and correctly, then upgrade process should be smooth.
Shukaku Wrote:1.2.12 is many years old...
Thanks. Guess why we are doing the update?Toungue

(2011-01-04, 06:16 PM)Yaldaram Wrote: [ -> ]If you've uploaded files completely and correctly, then upgrade process should be smooth.

Yes, I uploaded all the files.
This is an issue with the DB update mechanism, it is about fields that are missing in tables.
The upgrade scripts are brand new from the 1.6.1 version, can't be other because previously the install directory didn't even exist Wink
To my understanding these things are addressed in the upgrade script. At least all other DB things are taken care of there.
These are not, so I can only assume they are missing.
No criticism, the upgrade scripts are overall a great thing!
Just wanted to help...
The 1st, 2nd and 4th queries were done for the upgrade to 1.6, they're in upgrade17.php:

$db->rename_column("moderators", "uid", "id", "int unsigned NOT NULL default '0'");

$db->add_column("moderators", "isgroup", "int(1) unsigned NOT NULL default '0'");

$db->add_column("adminoptions", "loginlockoutexpiry", "int unsigned NOT NULL default '0'");

I don't know why you're trying to add a loginattempts field to the threads table though, this was moved from the sessions table to the users table in upgrade14.php, and was added to the adminoptions table and, for some reason, the users table again, in upgrade17.php:

$db->add_column("users", "loginattempts", "tinyint(2) NOT NULL default '1'");

$db->add_column("adminoptions", "loginattempts", "int unsigned NOT NULL default '0'");

It's never been in the threads table though, why do you think it has to be added there...??

If these things weren't in the upgrade scripts, we'd have been flooded with hundreds of threads from people with SQL errors about non-existant columns, we wouldn't only just be finding out now that these columns were missed...
(2011-01-04, 08:34 PM)MattRogowski Wrote: [ -> ]The 1st, 2nd and 4th queries were done for the upgrade to 1.6, they're in upgrade17.php:
For some reason the upgrade script did not include this file, only upgrade12.php


(2011-01-04, 08:34 PM)MattRogowski Wrote: [ -> ]I don't know why you're trying to add a loginattempts field to the threads table though,
Because I received an error that this file was missing while I tried to see a list of all forums.
Anyway, if I'm the only one who ran into this trouble never mind. Wink
If it only included upgrade12.php then you wouldn't have chosen the correct version from the upgrade script. I just read in your other thread that you rewrote upgrade.php and specifically upgrade12.php (don't know why only this one), so if the upgrade hasn't worked for you, that's probably why...

And if you got an SQL error saying the loginattempts column was missing from the threads table, it wouldn't have been running default code. I don't know what list of forums you mean specifically but the error wouldn't have said that this column was missing from the threads table.
(2011-01-05, 05:32 PM)MattRogowski Wrote: [ -> ]If it only included upgrade12.php then you wouldn't have chosen the correct version from the upgrade script. I just read in your other thread that you rewrote upgrade.php and specifically upgrade12.php (don't know why only this one), so if the upgrade hasn't worked for you, that's probably why...

That may be of course. Sorrz if i stirred up unnecessary trouble,
Can you give me a hint on how to include the various upgrade scripts in which order?