Page 1 of 1

upgradeTableDb

Posted: 06 September 2023, 15:13
by MathCT
Hello,

On my latest version I added a column in the player database. I did the necessary in game.php in the upgradeTableDb function but I think it doesn't work. In-progress games appear broken. Did I do things wrong? Can you help me?
Thanks in advance

in my sql file:

Code: Select all

ALTER TABLE `player` ADD `player_info` int(2) unsigned DEFAULT NULL;
in my game.php file: (the version 2309031908 is indeed the one just before the one where I touched the database.

Code: Select all

function upgradeTableDb( $from_version )
    {
        
    
    if( $from_version <= 2309031908 )
    {
    
    $sql = "ALTER TABLE DBPREFIX_player ADD `player_info` int(2) unsigned DEFAULT NULL";
    self::applyDbUpgradeToAllDB( $sql );
    }

    }

Re: upgradeTableDb

Posted: 06 September 2023, 15:23
by thoun
It looks correct.
Is there some information from one of the 2 logs from production on your manage game page?

Re: upgradeTableDb

Posted: 06 September 2023, 15:37
by MathCT

Code: Select all

http://boardgamearena.com/2/letscatchthelion/letscatchthelion/actSelect.html?lock=eabbcd26-a49c-4bdd-838a-db3b55c22445&arg1=token_2_1&arg2=square_2_2&table=414404634&noerrortracking=true&dojo.preventCache=1693982940013
06/09 08:49:08 [error] [T414404634] [150.66.83.163] [85754952/dhaula_giri] Error (1054) while processing SQL request: Unknown column 'player_info' in 'field list' - Request: SELECT player_info info FROM player WHERE player_id = '85754952'
06/09 08:49:08 [error] [T414404634] [150.66.83.163] [85754952/dhaula_giri] Unexpected exception: Error while processing SQL request (Localhost via UNIX socket): SELECT player_info info FROM player WHERE player_id = '85754952'
Unknown column 'player_info' in 'field list' (BGA service error 1693982948)
#0 /var/tournoi/release/tournoi-230829-1001-gs/www/include/APP_DbObject.inc.php(688): APP_DbObject::DbQuery()
#1 /var/tournoi/release/games/letscatchthelion/230905-2238/letscatchthelion.game.php(1078): APP_DbObject::getObjectListFromDB()
#2 /var/tournoi/release/tournoi-230829-1001-gs/www/game/module/table/gamestate.game.php(502): LetsCatchTheLion->stNextPlayer()
#3 /var/tournoi/release/tournoi-230829-1001-gs/www/game/module/table/gamestate.game.php(398): Gamestate->jumpToState()
#4 /var/tournoi/release/games/letscatchthelion/230905-2238/letscatchthelion.game.php(843): Gamestate->nextState()
#5 /var/tournoi/release/games/letscatchthelion/230905-2238/letscatchthelion.action.php(51): LetsCatchTheLion->actSelect()
#6 /var/tournoi/release/tournoi-230829-1001-gs/www/include/webActionCore.inc.php(189): action_letscatchthelion->actSelect()
#7 /var/tournoi/release/tournoi-230829-1001-gs/www/index.php(310): launchWebAction()
#8 {main}
is it normal?

Re: upgradeTableDb

Posted: 06 September 2023, 16:19
by thoun
Normal if update failed, but nothing related to the update itself :(

In your case, I make a new version to update the tables that failed. Look here : https://github.com/thoun/kingoftokyo/bl ... e.php#L804

Re: upgradeTableDb

Posted: 06 September 2023, 16:36
by MathCT
Thank you for your advice. I'm going to test that.