Docs
Database & AutoSQL
Register schema the Atlas way — no scattered ALTER TABLE.
Where schema lives
- Engine:
atlas_coreAutoSQL (RegisterSQL/SQL()) - Core tables:
atlas_core/server/schema.lua - Other resources:
exports.atlas_core:RegisterSQL('name', function() ... end)
Do not add numbered migration files (001_*.sql) under Atlas resources.
Pattern
lua
exports.atlas_core:RegisterSQL('my_resource', function()
local SQL = exports.atlas_core:SQL()
MySQL.query.await([[
CREATE TABLE IF NOT EXISTS my_resource_rows (
id INT AUTO_INCREMENT PRIMARY KEY,
character_uid VARCHAR(64) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
]])
SQL.ensureColumn('my_resource_rows', 'notes', 'VARCHAR(255) NULL')
end)Rules
- Idempotent and restart-safe
- Parameterized DML everywhere
- Table/column names are hardcoded constants — never player input
- Integer/minor-unit money in Atlas core (BIGINT cents)
Atlas