Migrating iniDB to extDB

  • Offline micovery
  • Moderator
  • Hardened
  • ******
  • Posts: 159

Migrating iniDB to extDB

« posted: Jan 04, 2015, 08:19 AM »
This is a Node.js module, (so far with just one script), to help server admins manage extDB (MySQL) database.


The first script I've implemented in this module is "inidb-2-extdb" ... for migrating iniDB data to extDB.

1. Download and install Node.js

2. Install the extdb-wasteland Node.js module from the NPM repository

Code: [Select]
npm install -g extdb-wasteland

3. Familiarize yourself with the script options

Code: [Select]
inidb-2-extdb --help
Options:
  --path       path to the directory that contains the database ini files       [required]
  --map-id     ID for the map                                                   [default: 1]
  --server-id  ID for server                                                    [default: 1]
  --prefix     prefix value for filtering the list of ini files (e.g. "A3W_")   [default: ""]
  --strings    list of variable names that should be coerced into String type   [default: "ownerUID,UID"]
  --numbers    list of variable names that should be coerced into Number type   [default: ""]
  --booleans   list of variable names that should be coerced into Boolean type  [default: ""]
  --ignored    list of variable names that should be ignored                    [default: ""]
  --trace      trace the JSON content of the parsed ini files                   [default: false]
  --help, -h   Show help                                                     

4. Use the script to migrate the iniDB data to SQL

Code: [Select]
inidb-2-extdb --path=/path/to/your/inidb/database

The script will create the following files with insert statements, for the respective tables.

* playerinfo.sql
* playersave.sql
* playerstats.sql
* serverobjects.sql
* servervehicles.sql

You must have already have the ServerInstance, and ServerMap tables already initialized with a server-id, and a map-id.


Report issues at:

https://github.com/micovery/extdb-wasteland


Pro-Tip:

Use the "--prefix" option to create the SQL scripts, just for specific files. e.g.

Code: [Select]
inidb-2-extdb --path=/path/to/your/inidb/database --prefix="A3W_SOMEUID"

Re: Migrating iniDB to extDB

« Reply #1 posted: Jan 19, 2015, 07:24 PM »
Does not work with massive amounts of player saves. It throws an error about stack size
  • Offline micovery
  • Moderator
  • Hardened
  • ******
  • Posts: 159

Re: Migrating iniDB to extDB

« Reply #2 posted: Jan 19, 2015, 08:43 PM »
Does not work with massive amounts of player saves. It throws an error about stack size

I see, ok. That's because of too many callbacks in the JavaScript code, I have to use "setImmediate" to prevent that.

Can you create an issue on  the Git page about it (make sure to include the stack trace/error you get).

You can work around this for now by doing it in smaller set of files at a time ... Since the SQL files created contain just inserts that are order-independent,  you can merge them later.