Files
mod-playerbots/data/sql
Icemansparks 0574ac5eff feature - (#1100) Linking of "trusted" accounts to allow altbot-control apart from own account or guild (#1267)
* Add table to store the security keys for accounts.

* Add table to store relationships between accounts.

* Add a new configuration option to enable or disable trusted account bots.

* add checks for linked accounts

* Handle account linking and chat commands

* fix uppercase typo

* change query & fix chatcommandtable

* add missing functions to header

* move account linking to updates dir

* moved table creation to correct updates folder

* use playerbots db instead of character db

* fix db

* fix install?

* remove duplicated logic and add hashing to stored securityKey

* add object before call

* change chat variable

* rename SQL file for correct execution order

* add  header include for ubuntu compatibility

* remove old sql
2025-05-05 15:06:29 +02: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