Distinguish bots from humans.

Players column now have three integers - first is real humans
count, second - bots count, and third - maximum players allowed
on this server. Also, sidebar will show bots count as well.
This commit is contained in:
2016-11-26 07:38:26 +05:00
parent 32c6297765
commit 280c65f116
5 changed files with 40 additions and 6 deletions

View File

@@ -48,6 +48,7 @@ func migrate_full(db *Database, version int) {
if version == 6 {six_to_seven(db); version = 7}
if version == 7 {seven_to_eight(db); version = 8}
if version == 8 {eight_to_nine(db); version = 9}
if version == 9 {nine_to_ten(db); version = 10}
}
// Initial database structure.
@@ -115,3 +116,10 @@ func eight_to_nine(db *Database) {
db.Db.MustExec("ALTER TABLE servers ADD is_private VARCHAR(1) NOT NULL DEFAULT '0'")
db.Db.MustExec("UPDATE database SET version=9")
}
// Bots count.
func nine_to_ten(db *Database) {
fmt.Println("Upgrading database from 9 to 10...")
db.Db.MustExec("ALTER TABLE servers ADD bots VARCHAR(2) NOT NULL DEFAULT '0'")
db.Db.MustExec("UPDATE database SET version=10")
}