Files
mod-playerbots/sql
Christoph Wilk a7a025ee58 Name Rework:
1. Arena Team & Guild Names: Edited/deleted/replaced many names by hand, removing potentially offensive names, grammatical inconsistency, faction-specific names (since there is no faction categorization), non-standard spelling, etc. After the rework there are 100 arena team names per bracket & 400 guild names, which is fewer than before, but should be enough.
2. Replaced the playerbot name list with 100k names (some overlap), split into 5k names per race and gender, with human & undead sharing the same pool of double size. Module code has been edited to assign created bots a name specific to their race.
3. Minor: Random race is now guaranteed to be assigned, removing the miniscule chance of failure in 15 attempts.
2024-08-13 20:21:00 +09:00
..
2024-08-13 20:21:00 +09:00
2021-12-30 17:13:09 +01:00

NEW MODULE - SQL BEST PRACTICES

Create a new table

Example:

CREATE TABLE IF NOT EXISTS `table`(
  `id` int(11) unsigned NOT NULL,
  `column` smallint(6) unsigned,
  `active` BOOLEAN DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Boolean datatype in mysql: Use TinyInt(1) or Boolean (this is the same thing)

bit(1) can also work, but it may require a syntax like b'(0) and b'(1) when inserting (not sure).

If there are multiple booleans in the same table, bit(1) is better, otherwise it's the same result.

Rules

  • Use InnoDB as engine for dynamic tables (most likely in the auth and characters databases).
  • Use MyISAM for read-only tables (in world database), but if you're not sure, just use innoDB.
  • Use utf8 as charset.

Resources

https://www.w3schools.com/sql/sql_datatypes.asp