Files
VMSolidus 260f744906 Skills System Revival: The Things She Remembered Had Never Been Her Own (#21853)
This PR is a revisit to the previously derelict PR #20159 that has been
unfinished for sometime now. More details about it in general can be
found here:
https://github.com/orgs/Aurorastation/projects/2?pane=issue&itemId=53167153

For awhile I've been talking about "Things I've been doing but it would
be really nice to do them with a skills system", or "And here's how I
would put this into the skills system when it's done". The main thing
that was stopping me from building it myself was having poor real life
skills in UI code and in DB code. However, I've gotten permission to
resume this PR, which has already completed the steps I would not have
been able to do myself. The rest of the PR fits well into my skillset as
a dev.

I'm opening this PR as a draft so as to enable my dev environment to
locally track all the previously modified files. I'll take this PR out
of draft and give this a full writeup when I have more work to show for
the PR this weekend.

### TODO

- [x] Rework a decent chunk of the currently existing skills to no
longer require hardcoded inserts into other systems. EG, converting from
classical ss13 methods, to modern /tg/-style ECS coding methods that
work off of component-signal patterns.
- [x] Make sure all of the existing skills have actual game
functionality (I won't PR a 2016 Baystation12 situation where 90% of the
skills are fluff only)
- [x] Add the various skills not yet made but are necessary for
completion sake, EG: Pilot (Spacecraft), Gunnery, Pilot (Walkers).
- [x] Examine each existing job in the game and assess whether it should
have a skill made with it in mind, or if it's covered by an existing
skill.
- [x] TO DISCUSS, BUT NOT ESSENTIAL: Additional skill proposals not
currently in the pre-existing TODO list, proposing subcategories.
- [x] Ensure that the previous TODO list is completed.

### Current Skills
The current list of skills, checkmarked for if I've completed them/they
have actual game mechanics. Or if we're just relegating them to separate
PRs. Originally this list was going to be forced to visit for a bare
minimum "does at least one thing" requirement, but now that is being
forgone due to this PR ballooning out of control and in complexity, as
well as development time overruns.

- [x] Bartending
- [x] Cooking
- [x] Gardening
- [x] Entertaining
- [x] Electrical Engineering
- [x] Mechanical Engineering
- [x] Atmospherics Systems
- [x] Reactor Systems
- [x] Medicine
- [x] Surgery
- [x] Pharmacology
- [x] Anatomy
- [x] Forensics
- [x] Robotics
- [x] Pilot: Spacecraft
- [x] Pilot: Exosuits
- [x] Research
- [x] Xenobotany
- [x] Xenoarchaeology
- [x] Xenobiology
- [x] Unarmed Combat
- [x] Armed Combat
- [x] Firearms
- [x] Leadership

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: FabianK3 <21039694+FabianK3@users.noreply.github.com>
Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
2026-04-18 14:33:48 +00:00
..

SQL

This subdirectory contains the required SQL files that are needed for setting up and updating a SQL database connected to the game. For nearly all local development a database isn't necessary, but some of the game's features require it.

Database management and/or development is a whole field on its own. If you have trouble, don't hesitate to ask a developer for assistance, specifically the people listed as code owners for the SQL directory.

Prerequisite

The production database is a MariaDB. Feature parity is no longer guaranteed for other SQL servers and requires that all SQL is tested on a MariaDB instance. If this is not done, migrations could fail and result in data loss or corruption.

For applying migrations Flyway by Redgate is used. It's a tool to automatically apply SQL scripts to a database server while keeping track of the already applied migrations.

In order to develop for the database you will require a MariaDB server instance and Flyway.

Tip

Users proficient with Docker can look further down: MariaDB and Flyway both offer container solutions alleviating the need to install either locally. Note: The usage of docker is too complex to be covered in this document. Refer to the official documentation of Docker, MariaDB and Flyway.

Migrations

Compacted Migrations

To decrease the runtime of the migration unit test, the database migrations will be compacted into a single migration on a regular basis. In order to do so, a new migrate-<year> subfolder is created. The initial migration in these subfolders is always a migration with the current db-schema as of the current PR.

In addition the flyway.conf file in the root of the project is updated to use the new migration folder and create a new schema history table (that tracks the applied migrations).

Usage of compacted migrations

If you set up a new database: Make sure to use the latest migration folder, it will contain everything needed to create a "fresh" database.

If you have an existing database: Update to the latest migration in the migration folder that you have used so far. Then switch to the next migration folder (and a new schema version table) You should use flyway with -baselineVersion="1" baseline instead of the usual migrate for the initial migration.

As usual, always make sure that you have a backup and test it first on a non-production copy.

Creating migrations

Creating migrations is relatively easy. Migrations are based on the previous ones and allow you to focus on the new changes you would like to implement.

First, figure out the changes you need to make. From table alteration and creation commands, to simply update and insert statements. This is the usual SQL writing for any database.

Place your .sql files in the SQL/migrate-<highest version> folder, in a valid order of execution. Name the file in the following format:

Vxxx__Description.sql

Where xxx is the next version number from the last existing file (include the 0s) and the description is a short description for the migration, with spaces replaced by underscores. You can orientate yourself on the already existing migrations.

Pushing these new files is all that is needed, testing aside.

Warning

You cannot edit migrations files that have been merged to the master branch. These files will not be run again and will cause issue when setting up a new database.

Initial database setup

In the root project directory, run the following:

path/to/flyway migrate
    -user=USER
    -password=PASSWORD
    -url=jdbc:mysql://HOST/DATABASE

Where USER is your database username, PASSWORD is your SQL password, HOST is the hostname of the SQL instance and DATABASE is the actual database you like to use on your SQL server instance.

Applying newly added migrations

Applying newly added migrations by yourself or others is very simple.

Just run the exact same command you ran above, fancy isn't it?

Flyway will automatically skip already applied migrations and only add those that are not yet existent in the database. This is also the underlaying reason applied migrations are written in stone and cannot be edited after they have been merged into the master branch.

Using a pre-Flyway database

Caution

This approach has issues due to improper versioning. Start with a fresh database and empty schema if possible.

The alternative is to make sure your database structure matches the V001 file within the migrate folder by manually modifying the structure to avoid data loss and then doing the steps described below.

If you're using a database since before we moved to Flyway, it's a bit more involved to get migrations working.

In the root project directory, run:

path/to/flyway baseline -user=USER -password=PASSWORD
    -url=jdbc:mysql://HOST/DATABASE
    -baselineVersion=001
    -baselineDescription="Initial schema"

From there, you can run migrations as normal.

Flyway config file

Instead of putting -user, -password and -url in the command line every time you execute flyway, you can use a config file. An example can be found in the repositories root directory, called flyway.conf:

flyway.url=jdbc:mysql://HOST/DATABASE
flyway.user=USER
flyway.password=PASSWORD

Now you can just run flyway migrate -configFile=flyway.conf and the settings will be loaded from config.

Misc tables

We included a set of miscellaneous tables in the misc folder. These are primarily used for debugging and are not meant to be pushed into production. As such, they're not included in the migration folder.

Ignoring or implementing them should not cause issues with the system.

Docker

Docker allows you to setup a database and Flyway without installing additional components locally. This setup is for directed at advanced users proficient with Linux/Bash and Docker. Provided is a jumpstart example, refer to the individual documentations: MariaDB docker and Flyway docker.

Advantages: No installation of additional components, easy to spin up/remove and changes are stored in volumes.

services:
    flyway:
        image: flyway/flyway
        command: -url=jdbc:mysql://db -user=root -password=my-password -defaultSchema=aurora migrate
        volumes:
            - ./SQL/migrate-VERSION:/flyway/sql # Pathing!
        depends_on:
            - db
    db:
        image: mariadb
        environment:
            MARIADB_ROOT_PASSWORD: my-password
        volumes:
            - aurora:/var/lib/mysql:Z
        ports:
        - 3306:3306

volumes:
  aurora: