Smart Database Initialization
Smart Database Initialization
Nord Crafting includes a database initializer and migration system.
First start
When automatic creation is enabled, the resource:
- Waits for
oxmysql. - Ensures the settings table exists.
- Creates required Crafting tables.
- Inserts default data where required.
- Runs migrations.
- Stores the schema version.
- Writes local state to
server/db_state.json.
Smart restart behavior
server/db_state.json stores the current schema version. When the local state and database are already current, Crafting can skip unnecessary heavy CREATE/ALTER work on normal restarts.
Manual SQL
A full SQL file remains available at:
install/sql.sql
Use it when your deployment policy requires manual schema management.
Readiness export
local ready = exports['nord_crafting']:IsNordDBReady()
This is useful for another server resource that must wait for Crafting's database layer before calling database-backed APIs.