Code:
DROP TABLE IF EXISTS samp_bans;
CREATE TABLE IF NOT EXISTS samp_bans (
ban_id int(4) NOT NULL AUTO_INCREMENT,
ban_log_id int(4) NOT NULL,
ban_date datetime NOT NULL,
ban_type enum('single','range') CHARACTER SET latin1 NOT NULL,
ban_address int(4) NOT NULL,
ban_address_end int(4) NOT NULL,
PRIMARY KEY (ban_id),
KEY ban_address (ban_address),
KEY ban_address_end (ban_address_end),
KEY ban_log_id (ban_log_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table 'samp_logs'
--
DROP TABLE IF EXISTS samp_logs;
CREATE TABLE IF NOT EXISTS samp_logs (
log_id int(4) NOT NULL AUTO_INCREMENT,
log_date datetime NOT NULL,
log_type enum('warn','kick','ban','unban','note','banip','sexy','fucked') CHARACTER SET latin1 NOT NULL,
log_address int(4) DEFAULT NULL,
log_user_name varchar(24) COLLATE utf8_unicode_ci NOT NULL,
log_user_id int(4) DEFAULT NULL,
log_subject_name varchar(24) COLLATE utf8_unicode_ci NOT NULL,
log_subject_id int(4) DEFAULT NULL,
log_reason varchar(128) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (log_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;The structure has changed a bit while I was trial-and-erroring the import.
The preferred way to insert new rows into samp_logs is as follows:
- log_id - None, this is automatically incremented.
- log_date - The current date, should be obvious.
- log_type - The type of log item, one of 'warn','kick','ban','unban','note','banip'.
- log_address - The IP address belonging to the log item. May be NULL in some cases (for example a note or a warn).
- log_user_name - The nickname of the person adding the log item (typically an administrator).
- log_user_id - The ID of the person adding the log item. May be NULL in some cases (like when adding a note or unbanning from IRC).
- log_subject_name - The nickname of the person getting raped.
- log_subject_id - The ID of the person getting a log item. May be NULL, for example when unregistered.
- log_reason - The thing we came for: the actual message.