Working with the database

The database does not have full GUI admin support. To handle some things, you will need to get a tool like MySQL Workbench and do some manual editing. I'll use MySQL Workbench for tutorials here, otherwise it is similar for all other mysql clients too.

Tables you should never, ever touch in MySQL
...unless you know exactly what you're doing. You can mess stuff up royally otherwise.

erro_admin, erro_admin_log, erro_ban, erro_feedback, erro_player, erro_privacy, erro_poll_vote and erro_poll_textreply. Never ever touch any of these tables. They have GUI support ingame and you should never touch them outside.

Adding a new poll
To add a new poll, once you are connected to the database with an account with the SELECT and INSERT rights:
 * Double click the name of the database which contains the erro_poll_* tables, if the database name is not bold already. This will select the database as the default.
 * Expand the database tree on the left until you see the following four tables: erro_poll_question, erro_poll_option, erro_poll_vote and erro_poll_textreply.
 * Right click on erro_poll_question and select 'Edit Table Data'
 * An empty table will appear. Click on the row full of 'null' entries to edit the new row's content
 * Keep id null
 * Enter one of the following in polltype: OPTION (poll where you select one option from a list), TEXT (where people enter text replies), NUMVAL (where you rate options with a number, like 1-5 star votes) or MULTICHOICE (for multiple choice polls). Make sure the values are exact - in caps with no leading or ending spaces.
 * Set the start time and end time in the next two columns. Use this template: YYYY-MM-DD HH:MM:SS ; Example: 2013-01-05 00:00:00. Make sure the end time is after the start time.
 * Enter the question in the next column, marked question. Do not use any HTML.
 * If you want the poll to be admin-only, insert 1 in the next column (adminonly), if not, keep it at 0
 * If you selected the poll type as MULTICHOICE, insert how many options you want players to be allowed in the next column, marked multiplechoiceoptions.


 * Click 'Apply' in the bottom right and 'Execute' on the window that pops up.
 * With this you have created a new poll qestion. You'll need to add options to it. Before you close the tab where you're editing data, look at which ID the newly inserted role was given. The ID will most often be the next available integer. If you started with an empty table, this will probably be 1. This value will be the poll id.
 * Now right click on erro_poll_option and select 'Edit Table Data'.
 * You will need to enter multiple rows this time - one for each option you wish to have. You don't need to do this part if you set the poll type to TEXT.
 * Keep each row's id field as null
 * Set each row's pollid field to the poll ID that was assigned to the row in erro_poll_question - The number I told you to mark down.
 * Set the next field (marked 'text') to whatever you want the option text to be. You can use HTML here, but don't use anything past bold, italic and such, as it's pretty easy to mess up.
 * Set percentagecalc to either 1 or 0, depending if you want the poll option to be counted in percentage calculations. Usually you will want all of these to be set to 1, except for the "Abstain" or "Don't care" option.
 * Keep all the other values as null, UNLESS you set the poll type to NUMVAL. If this is a numeric poll, you will need to at least set 'minval' and 'maxval' to the minimum and maximum value you want players to select from. If you want a 1-5 star rating, set minval to 1 and maxval to 5. Sometimes it is not obvious which way is up, so you can also set 'descmin', 'descmed' and 'descmax'. So if you set descmin to 'worst' and descmax as 'best' in the 1-5 star poll, the poll options will be presented as 1 (worst), 2, 3, 4, 5 (best) when players open the poll. The 'descmed' is for the option in the middle. So if you are, for example, trying to determine if a change was for the better, you can make a poll like "text='Did this change improve the game?', minval = -3, maxval = 3, descmin = 'much worse', descmed = 'about the same', descmax = 'much better'". This will appear to voting players as -3 (much worse), -2, -1, 0, 1, 2, 3 (much better)

Adding your first admin
When you import the database and enable database based administration (config.txt, put a # infront of ADMIN_LEGACY_SYSTEM), the admins table will be empty, meaning noone will be identified as an admin. You'll have to add the first admin manually.

If you're running XAMPP:
 * Go to http://localhost/phpmyadmin (Must have Apache and MySql running, see Setting up the database for help on that)
 * Open the database you have designated for feedback
 * Open the erro_admin table
 * Click 'Insert' in the top row
 * Keep id field blank; insert your ckey into the ckey row; insert an appropriate rank title, such as "Server Host", into the rank field, keep level at default and insert the following number into the flags field: 8191. This number represents your permissions and may change over time. If you get problems later on, replace this with 65535 or ask for help in #coderbus on irc.rizon.net.
 * Insert this row.


 * ALTERNATIVE: If you know what SQL is, use this statement: INSERT INTO `erro_admin` VALUES (null,'ckey','Server Host',1,8191)
 * Replace the word ckey with your ckey, but keep the single quotes before and after it.