Added world_name and land columns to the servers table to provide easier identification for external and internal applications utilizing the database

This commit is contained in:
Eclipse
2022-09-04 01:16:15 -04:00
parent df1a4834ba
commit dc874877d7
2 changed files with 15 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ import (
"erupe-ce/server/entranceserver"
"erupe-ce/server/launcherserver"
"erupe-ce/server/signserver"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"go.uber.org/zap"
@@ -173,6 +174,8 @@ func main() {
ci := 0
count := 1
for _, ee := range erupeConfig.Entrance.Entries {
cn := 1
for _, ce := range ee.Channels {
sid := (4096 + si*256) + (16 + ci)
c := *channelserver.NewServer(&channelserver.Config{
@@ -192,12 +195,13 @@ func main() {
if err != nil {
preventClose(fmt.Sprintf("Failed to start channel server: %s", err.Error()))
} else {
channelQuery += fmt.Sprintf("INSERT INTO servers (server_id, season, current_players) VALUES (%d, %d, 0);", sid, si%3)
channelQuery += fmt.Sprintf("INSERT INTO servers (server_id, season, current_players, world_name, land) VALUES (%d, %d, 0, '%s', %d);", sid, si%3, ee.Name, cn)
channels = append(channels, &c)
logger.Info(fmt.Sprintf("Started channel server %d on port %d", count, ce.Port))
ci++
count++
}
cn++
}
ci = 0
si++

View File

@@ -0,0 +1,10 @@
--adds world_name and land columns
CREATE TABLE IF NOT EXISTS public.servers
(
server_id integer NOT NULL,
season integer NOT NULL,
current_players integer NOT NULL,
world_name text COLLATE pg_catalog."default",
land integer
)