Skip to content

Migration from other controllers

wsrvn edited this page Jan 15, 2024 · 8 revisions

Migration

Warning

Migrating from FAST is NOT supported.

This page will help you migrate your XASECO database to Trakman.

Preface

There is already a script that does all the hard work. You will only need to provide the script with the correct database credentials.

Create the database you want to migrate to

Firstly, you must create a database that you will migrate all the data into. This is discussed in the video tutorial, and can also be found freely on the internet, e.g. here.

Obtain the script source

You can get the files here.

Using Git (CLI)

  1. git clone https://github.com/wsrvn/xaseco-database-migration.git --depth 1
  2. Done. You can skip to configuration now

Using Github (Web)

  1. Go to the project main page
  2. Click the green button that says "Code"
  3. Select the "Download ZIP" option
  4. Extract the downloaded archive wherever you like. Skip ahead to configuration

Settings

Firstly, go into the directory with the script source code, either via cd xaseco-database-migration in terminal/powershell or via your file explorer.

There, start off by copying the file .env.example to .env, usually done with the command cp .env.example .env in the terminal/powershell. This file holds all the database data that is used for the migration process.

Inside .env the configurable values are split into categories:

MySQL Settings

Variable Name Value Type Description
MYSQL_HOST Valid IP address MySQL database host
MYSQL_USER String MySQL database user
MYSQL_PASSWORD String MySQL database user password
MYSQL_DATABASE String MySQL database name

PostgreSQL Settings

Variable Name Value Type Description
POSTGRES_HOST Valid IP address PostgreSQL database host
POSTGRES_USER String PostgreSQL database user
POSTGRES_PASSWORD String PostgreSQL database user password
POSTGRES_DATABASE String PostgreSQL database name
POSTGRES_PORT 1-65535 PostgreSQL database host port

Migration Settings

Variable Name Value Type Description
MIGRATE_PLAYERS YES/NO Whether to migrate the players table. Note that this one is mandatory
MIGRATE_RECORDS YES/NO Whether to migrate the records table (NOT rs_times)
MIGRATE_VOTES YES/NO Whether to migrate the rs_karma table
MIGRATE_BEST_SECTORS YES/NO Whether to migrate the secrecs_all table (enable ONLY if you use the XASECO secrecs plugin)
MIGRATE_ALL_SECTORS YES/NO Whether to migrate the secrecs_own table (enable ONLY if you use the XASECO secrecs plugin)
MIGRATE_DONATIONS YES/NO Whether to migrate the players_extra.donations table

Launching the script

Warning

Choosing to migrate the sector records table without having the secrecs_all or secrecs_own table (created by the XASECO secrecs plugin) in the MySQL database will crash the script.

Prior to first launch, make sure the provided data is correct, otherwise the migration script will fail.

Obtaining the dependencies

Open the terminal/powershell in the root directory of the project (where you unpacked the code or what directory git cloned it into), after that:

  1. Execute npm i, this will install all the project dependencies.

Tip

If you don't have the npm command available, but have installed NodeJS, it is likely that it was not added to your $PATH. Usually, logging out and back in fixes this.

Migrating

  1. Execute node Migrate.mjs.
  2. Wait until the process is complete, the time it takes depends on the size of your MySQL database and whether you have sector migration enabled.

Afterword

If no errors popped up, that means the migration (most likely) went smoothly. You can now proceed to the controller installation page in case you have not already. Should the script have a hiccup, you can report that in the issues section of the script repository.