Database management
This article covers how to modify data in the database.
Table of contents
- Moving data from SQLite to MySQL
- Moving to Online only UUIDs from Offline UUIDs
- Backup and restore
- Removing a player
- Removing a server
- Resetting one server's data
- Removing data of a bot attack
- Removing ALL data
Moving data from SQLite to MySQL
Perhaps you want to migrate the database to MySQL. Note: Moving data REMOVES ALL DATA FROM THE RECEIVING DATABASE.
- Set up your MySQL
- Set
Database.Type
back as SQLite until the move has completed, make sure your MySQL works before this. - Run
/plan db move SQLite MySQL
/plan reload
Same works in reverse for MySQL to SQLite!
Moving to Online only UUIDs from Offline UUIDs
If you're moving to online-mode after long offline-mode run, or if you accidentally misconfigured UUIDs and Plan has gathered duplicate players with 2 different UUIDs, no worries!
- Run
/plan db migrate_to_online_uuids
to have Plan combine the entries - If you would also like to remove offline players that don't have an online UUID at all, use
/plan db migrate_to_online_uuids --remove_offline
Backup and restore
- To back up the current database run
/plan db backup
- To restore from a backup use
/plan db restore <backup file name>
. You can tab complete the file names.
Removing a player
Command /plan db remove <player>
, takes the name or UUID of the player to be removed.
Removing a web user
Command /plan unregister <username>
, takes the username of the web user. You can use /plan users
to list the users and linked player names.
Removing a server
Command /plan db uninstalled <server>
, takes id, name or UUID of the server to be removed. You can use /plan servers
to get the IDs.
Resetting one server's data
Maybe you have multiple servers in your network so /plan db clear
is not good (it deletes ALL data).
- Remove
/plugins/Plan/ServerInfoFile.yml
of the server you want to reset /plan reload
that server to get a new UUID for the server/plan db uninstalled <old server>
to remove the old server. You can use/plan servers
to get the IDs.
Removing data of a bot attack
A bot attack usually messes up the peak calculations. Removing that data needs manual SQL query to the database.
Removing bot users who did not join game servers:
DELETE FROM plan_users WHERE uuid NOT IN (SELECT DISTINCT uuid FROM plan_sessions);
Removing bad tps data:
DELETE FROM plan_tps WHERE date>{start} AND date<{end} AND players_online>{above value};
Replace the variables in {square brackets}
(remove the brackets as well)
start
is epoch millisecond of the start time of the attackend
is epoch millisecond of the end time of the attackabove value
should be above 0, use it to further limit what data is removed.
Removing ALL data
To remove all data run /plan db clear
.
All Plan instances connected to the database need to be reloaded afterwards as the missing server records will cause errors in running instances.
If you wish to uninstall Plan entirely use DROP DATABASE Plan;
in MySQL instead.
Documentation
Tutorials
Configuration
- Game server Set-up
- Network Set-up
- Game server Configuration
- Network Configuration
- Login / HTTPS Set-Up
- Commands & Permissions
- Database management
- PlaceholderAPI