Open Boux opened 8 years ago
Do you have correct permission to alter tables on specific columns? I myself have never seen this issue.
I should have, I haven't changed anything. If I drop my database and start over by running the server, it creates everything except the lastseen
field in playerrank
. I use the exact same user/pass in my database.cfg and when I connect to it from the command line, but executing ALTER TABLE playerrank ADD lastseen DATE
works from the command line.
Edit:
here's my db config
"kztimer"
{
"driver" "mysql"
"host" "127.0.0.1"
"database" "kztimer"
"user" "root"
"pass" "root"
//"timeout" "0"
"port" "3306"
}
and here's my database rights
mysql> show grants for 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
.... actually this could be the issue, since I connect to the host 127.0.0.1
instead of localhost
in my db config. (for some reason using localhost in my db config prevented my server to connect to the db, maybe my hosts file).
mysql> show grants for 'root'@'127.0.0.1';
ERROR 1141 (42000): There is no such grant defined for user 'root' on host '127.0.0.1'
but then why would all the other ALTER TABLE
queries work?
Wait no what am I saying, this wouldn't change anything since it's where the user connect from, not the opposite. Still don't know what could cause this.
What is the OS? Are you using mysql? Are the tables InnoDB?
Ubuntu 16.04 and yeah mysql.
Here's my table status
mysql> show table status;
+------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| LatestRecords | InnoDB | 10 | Dynamic | 33 | 496 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | 2016-07-16 15:05:28 | NULL | latin1_swedish_ci | NULL | | |
| MapButtons | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | NULL | NULL | latin1_swedish_ci | NULL | | |
| challenges | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | NULL | NULL | latin1_swedish_ci | NULL | | |
| playerjumpstats3 | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | 2016-07-14 17:16:45 | NULL | latin1_swedish_ci | NULL | | |
| playeroptions2 | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:50:15 | 2016-07-10 16:49:52 | NULL | latin1_swedish_ci | NULL | | |
| playerrank | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | NULL | 2016-07-11 18:43:35 | 2016-07-16 15:05:29 | NULL | latin1_swedish_ci | NULL | | |
| playertimes | InnoDB | 10 | Dynamic | 29 | 564 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | 2016-07-16 15:05:28 | NULL | latin1_swedish_ci | NULL | | |
| playertmp | InnoDB | 10 | Dynamic | 1 | 16384 | 16384 | 0 | 0 | 0 | NULL | 2016-07-10 15:47:31 | 2016-07-16 15:05:47 | NULL | latin1_swedish_ci | NULL | | |
+------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+------
You are using the latest Metamod snapshot with the latest Sourcemod snapshot and use kztimer 1.84, right?
I'm guessing there are no errors in Sourcemod error logs other than kztimer not being able to select the columns but just to be sure can you still send the sourcemod error log.
Does anything change if you let kztimer remake the database? Try disabling kztimer and start your server. Go to your console and load kztimer with sm plugins load KZTimerGlobal
. Check in console if kztimer reports any errors.
Some of the
ALTER TABLE
queries do not work, and some do work, I'll list everything I've tested.As
lastseen
is not in the originalCREATE TABLE
, we need to add it, but it's simply not added, here's what my table looks likeThe
lastseen
field is used in multiple select queries, which simply gives an error in the server's console and doesn't do anything, as in the player rank is not calculated or saved.If I manually execute the table alteration query in the mysql prompt, the column is added without error.
As for other tables, nothing seems to be broken.
In
playertmp
, theEncTickrate
field needs to be added, but it's already in theCREATE TABLE
query :EncTickrate INT(12) NOT NULL DEFAULT '-1.0'
so it's fine for new instances.In
playeroptions2
, these 4 fields need to be added :ViewModel AdvInfoPanel ReplayRoute Language
, none of which are in theCREATE TABLE
query so the table alteration queries all seem to work properly.In
playerjumpstats3
, it seems to be the same asplayeroptions2
, all fields are correctly added to the table even if they are not in the originalCREATE TABLE
query.So there's the inconsistency. The
playerrank
table is not altered properly while the other tables are. I have no idea what could cause this, so I'm just posting my tests' results here.