Skip to content

ax.database

Source: gamemode/framework/libraries/sv_database.lua

Database management system for handling connections, schema definitions, and table creation.

Documented functions: 4

Functions


ax.database:AddToSchema(schemaType, field, fieldType)

Add a field to the database schema. Adds a new field to a specified table schema, handling queuing if database isn't ready.

Realm: server

Parameters

Name Type Description
schemaType string The table name to add the field to
field string The field name to add
fieldType number The ax.type constant for the field type

Usage

ax.database:AddToSchema("ax_characters", "description", ax.type.text)

ax.database:Connect(module, hostname, user, password, database, port)

Connect to the database using specified parameters. Establishes connection using mysqloo module with configurable database settings.

Realm: server

Parameters

Name Type Description
module string Database module type (default: "sqlite")
hostname string Database hostname (default: "localhost")
user string Database username (default: "root")
password string Database password (default: "")
database string Database name (default: "parallax")
port number Database port (default: 3306)

Usage

ax.database:Connect("mysql", "localhost", "user", "pass", "gamedb")

ax.database:CreateTables()

Create the default database tables for the framework. Sets up schema tracking, players, characters, and inventories tables.

Realm: server

Usage

ax.database:CreateTables()

ax.database:InsertSchema(schemaType, field, fieldType, callback)

Insert a field into the database schema (internal use). Directly modifies database schema and table structure.

Realm: server

Parameters

Name Type Description
schemaType string The table name
field string The field name
fieldType number The ax.type constant for the field type
callback function Optional callback to run when schema insert completes

Usage

ax.database:InsertSchema("ax_characters", "description", ax.type.text)