Database migrations
You never import SQL by hand. bs_core creates and upgrades the schema itself on boot.
How it runs
Section titled “How it runs”- Migration files are in
bs_core/sql/, numbered (001_core_schema.sqlup to035_faction_jobs.sqlright now). - On start
bs_coreruns every file in its list that isn’t recorded yet, in order, and records it in thebs_migrationstable with a checksum. A file never runs twice. - The console prints what it applied on that boot.
- A few resources make their own small tables with
CREATE TABLE IF NOT EXISTSon start (for examplebs_testerandbs_config). Nothing to do for those either.
The recent ones
Section titled “The recent ones”| File | Adds |
|---|---|
029_vehicle_world.sql | World vehicles, missing parts |
030_user_language.sql | bs_users.language |
031_building.sql | bs_build_pieces, bs_build_bases, moves old structures to factions |
032_crafting.sql | Station queues, traps, offline refunds, recycler points |
033_medical.sql | bs_character_medical: injuries, infection, sickness, blood |
034_base_flags.sql | Safezone and outpost flags, declared raids |
035_faction_jobs.sql | Job members, the board, scores, job picks, garage work |
045_darkzone.sql | Dark Zone (1.1.0) |
046_building_v2.sql | Building v2: power, generators, flags (1.1.0) |
047_faction_emblems.sql | Faction emblems (1.1.0) |
048_backpack_refresh.sql | Backpack items renamed, contents kept (1.1.0) |
Adding one
Section titled “Adding one”- Make the next number:
bs_core/sql/036_my_change.sql. - Write it so it’s safe on a database that already has data. Add columns with defaults, don’t drop things people still use.
- Add the filename to the list in
bs_core/server/sv_migrations.lua(M.files). The list is hardcoded. A file that isn’t in it is silently never run. - Restart the server (restarting
bs_corealone kicks everyone).
Backups
Section titled “Backups”Before an update that adds migrations, back up. On Windows:
powershell -ExecutionPolicy Bypass -File .\tools\Backup-Database.ps1See Updating & database for restore and moving characters between servers.
bs19.org · Privacy · Terms · Cookie settings
Cookies and outside content
The site only needs two essential cookies to keep you logged in and protect forms. Videos and streams from YouTube and Twitch load from their servers, which can set their own cookies, so they stay off until you say yes. Nothing is pre-ticked and you can change your mind any time with "Cookie settings" at the bottom of every page. Details.
Questions about the server, the framework or the site? A real person reads this, usually within a day.