2.8 KiB
Database setup (2019)
Creates the four databases the 2019 servers use, with the original names:
| Database | Used by |
|---|---|
LosaGame |
game data and accounts (DB agent ls_dbagent_game) |
LosaGame_log |
game-side logs, written by procedures in LosaGame |
LosaLogData |
log server data (DB agent ls_dbagent_logdb) |
Backup |
stays empty: game procedures such as game_practice_rank_reward and game_region_backup_point create their own tables in it |
The schema is the 2021 release's full scripts. The 2019 release's own scripts (sql\20120504 + the patches in DB\) are a 2012 base and lack 212 of the 401 procedures the 2019 server calls; the 2021 schema matches all but a few, which 07_losadev_2019_procs.sql adds (game_member_count, game_member_add, game_create_nickname, game_pingpong, the Indonesia game_game_get_data).
Tested 2026-11-07 on SQL Server 2022 Express: every script runs without an error; LosaGame has 134 tables / 1065 procedures, LosaGame_log 20 / 2, LosaLogData 67 / 81; both logins connect, the game login can create tables in Backup; backup and restore of all four work.
Needs
- SQL Server 2019 or newer (Express is enough) with SQL Server and Windows authentication (mixed mode).
sqlcmdon PATH.- Recommended: instance collation
Korean_Wansung_CI_AS, like the original service.
Setup
setup-db.bat .\SQLEXPRESS
It asks for the DB agent password (SQL logins lstggame and lstglog; put it in PW= of the ls_dbagent.ini files in server-config\) and the encode key (15 characters, define_encode_key). set DB_COLLATE=Korean_Wansung_CI_AS before running forces a collation. Logs go to logs\.
| Script | Does |
|---|---|
00_create_databases.sql |
creates LosaGame, LosaGame_log, LosaLogData, Backup |
01_logins.sql |
SQL logins lstggame, lstglog |
02_LosaGame_log.sql, 03_LosaLogData.sql, 04_LosaGame.sql |
the 2021 release schema (only the CREATE DATABASE block taken out) |
05_users.sql |
db_owner users for the logins |
06_encode_key.sql |
the encode key |
07_losadev_2019_procs.sql |
the procedures the 2019 server needs on top of the 2021 schema |
08_first_tournament.sql |
the first tournament row (Faction / LS Cup screens) |
optional\test-accounts.sql |
test accounts tester1 and gmtest1 (Indonesia IDs need 6-12 characters), run by hand |
Backup and restore
backup.bat D:\LosaBackup .\SQLEXPRESS
restore.bat 20261107_1400 D:\LosaBackup .\SQLEXPRESS
backup.bat writes <database>_<yyyyMMdd_HHmm>.bak for all four databases (online). restore.bat asks first and replaces all four: stop every server before restoring. It restores to the paths stored in the backup (same server); on another server use RESTORE DATABASE ... WITH MOVE by hand.