Smart Database Initialization

Nord Crafting includes a database initializer and migration system.

First start

When automatic creation is enabled, the resource:

  1. Waits for oxmysql.
  2. Ensures the settings table exists.
  3. Creates required Crafting tables.
  4. Inserts default data where required.
  5. Runs migrations.
  6. Stores the schema version.
  7. 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.


Revision #1
Created 2026-09-03 18:18:53 UTC by Riguita
Updated 2026-09-03 18:18:53 UTC by Riguita