OnLoadTables

GM:OnLoadTables

Description
This function ran on when server loads the database table. This can be used to setup your own database of schema/plugin

Arguments
none.

Return Values
none.

Examples
Example from DarkNuts Schema: sv_hooks.lua local MYSQL_CREATE_TABLES = CREATE TABLE IF NOT EXISTS `nut_reserve` (	`_charID` int(11) NOT NULL,	`_reserve` int(11) unsigned DEFAULT NULL,	PRIMARY KEY (`_charID`) ); CREATE TABLE IF NOT EXISTS `nut_guestboard` (	`_postID` int(11) NOT NULL AUTO_INCREMENT,	`_steamID` bigint(20) NOT NULL,	`_steamName` varchar(32) NOT NULL,	`_text` text NOT NULL,	PRIMARY KEY (`_postID`) ); local SQLITE_CREATE_TABLES = CREATE TABLE IF NOT EXISTS `nut_reserve` (	`_charID` INTEGER PRIMARY KEY,	`_reserve` INTEGER ); CREATE TABLE IF NOT EXISTS `nut_guestboard` (	`_postID` INTEGER PRIMARY KEY,	`_steamID` INTEGER,	`_steamName` TEXT,	`_text` TEXT );

function SCHEMA:OnLoadTables if (nut.db.object) then -- This is needed to perform multiple queries since the string is only 1 big query. local queries = string.Explode(";", MYSQL_CREATE_TABLES)

nut.db.query(queries[1]) nut.db.query(queries[2]) else nut.db.query(SQLITE_CREATE_TABLES) end end