Skip to content

Database

François Poguet edited this page Apr 1, 2021 · 28 revisions

Database

The database uses an automatic update system, allowing it to receive a script to perform the update. The update will be executed when the server is started.

When the number of updates increases, it is a good idea to recreate a database creation script with the new additions.

How to update the database schema

  1. Add the new version in the versions array in /server/db/database.js
  2. Add the update SQL script in the /server/db/updates/ directory, following the naming convention : db_YYYYMMDD_to_YYYYMMDD.sql
  3. Complete the structure object in server/test/database.test.js

Update script template

-- YOUR SCRIPT HERE

UPDATE `server_informations`
    SET `value` = "YYYY-MM-DD" WHERE `key` = "api_version";
Clone this wiki locally