Stability fixes, profile path and more.
Fixed a bunch of data races which should lead in stability improvements. Added possibility to specify game profile path within profile item. Added Urban Terror 4.3.2.
This commit is contained in:
@@ -49,11 +49,13 @@ func (d *Database) Close() {
|
||||
tx.Commit()
|
||||
|
||||
d.Db.Close()
|
||||
|
||||
runtime.UnlockOSThread()
|
||||
}
|
||||
|
||||
func (d *Database) Initialize(cfg *configuration.Config) {
|
||||
fmt.Println("Initializing database...")
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
||||
// Connect to database.
|
||||
@@ -75,10 +77,6 @@ func (d *Database) Initialize(cfg *configuration.Config) {
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Database) Lock() {
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
|
||||
func (d *Database) Migrate() {
|
||||
// Getting current database version.
|
||||
dbver := 0
|
||||
@@ -94,7 +92,3 @@ func (d *Database) Migrate() {
|
||||
|
||||
migrate_full(d, dbver)
|
||||
}
|
||||
|
||||
func (d *Database) Unlock() {
|
||||
runtime.UnlockOSThread()
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ func migrate_full(db *Database, version int) {
|
||||
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}
|
||||
if version == 10 {ten_to_eleven(db); version = 11}
|
||||
}
|
||||
|
||||
// Initial database structure.
|
||||
@@ -123,3 +124,10 @@ func nine_to_ten(db *Database) {
|
||||
db.Db.MustExec("ALTER TABLE servers ADD bots VARCHAR(2) NOT NULL DEFAULT '0'")
|
||||
db.Db.MustExec("UPDATE database SET version=10")
|
||||
}
|
||||
|
||||
// Urban terror's profile path.
|
||||
func ten_to_eleven(db *Database) {
|
||||
fmt.Println("Upgrading database from 10 to 11...")
|
||||
db.Db.MustExec("ALTER TABLE urt_profiles ADD profile_path VARCHAR(4096) NOT NULL DEFAULT '~/.q3ut4'")
|
||||
db.Db.MustExec("UPDATE database SET version=11")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user