Files
redl-fivem-rp/sql/schema.sql
T
Claude Opus 5andClaude Opus 5 c857979a55 FiveRP: the server from the hosting account, not the earlier one
Wrong server was published before. This is the one that runs on the
hosting account the video was made on: FiveRP - two-step registration
(account, then an identity printed onto a passport), login that returns
you to your resident, and a loading screen driven by the game's own
streaming events.

  resources/[local]/fiverp-auth          NUI + scrypt hashes + oxmysql
  resources/[local]/fiverp-characters    identity, character load, spawn
  resources/[local]/fiverp-loadscreen    loading screen
  sql/schema.sql                         accounts, characters
  docs/DESIGN.md                         the design system every screen follows
  docs/screens/                          shot from the live server

Only our own code is in here. cfx-server-data and oxmysql are fetched by
install.sh instead of being vendored, which keeps the repo at 3.7 MB.

install.sh does the whole box in one command: recommended FXServer
build, cfx-server-data, oxmysql, MariaDB with the schema, resources,
server.cfg (mode 600 - it carries the key and the database password),
boot entry, then it waits for the Cfx registration. Tested end to end on
a spare install root: 29 resources scanned, database and schema created,
and it stopped exactly where a wrong licence key should stop it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 23:42:20 +00:00

38 lines
1.6 KiB
SQL

-- ---------------------------------------------------------------------------
-- FiveRP - database schema
-- mysql fiverp < sql/schema.sql (install.sh applies this for you)
-- ---------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS accounts (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR(190) NOT NULL,
username VARCHAR(32) NOT NULL,
password_hash VARCHAR(255) NOT NULL, -- scrypt, salt and cost live inside the hash
license VARCHAR(64) DEFAULT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_login DATETIME DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_email (email),
UNIQUE KEY uq_username (username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS characters (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
account_id INT UNSIGNED NOT NULL,
slot TINYINT UNSIGNED NOT NULL DEFAULT 1,
first_name VARCHAR(32) NOT NULL,
last_name VARCHAR(32) NOT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
model VARCHAR(32) NOT NULL DEFAULT 'mp_m_freemode_01',
appearance LONGTEXT DEFAULT NULL, -- JSON, written by fiverp-characters
pos_x FLOAT DEFAULT NULL,
pos_y FLOAT DEFAULT NULL,
pos_z FLOAT DEFAULT NULL,
heading FLOAT DEFAULT NULL,
last_played DATETIME DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_slot (account_id, slot),
CONSTRAINT fk_char_account FOREIGN KEY (account_id)
REFERENCES accounts(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;