TC ScriptDocumentation

Database

The full tc-mechanic SQL, ready to import.

#Installation

Import the file once into the database used by oxmysql. It is idempotent (CREATE TABLE IF NOT EXISTS): running it again breaks nothing. Tables are also created automatically when the resource starts.

Download install.sql

#Tables

TableContent
tc_mech_settingsIn-game settings, per section
tc_mech_pointsWorkshop points
tc_mech_ordersOrders and quotes
tc_mech_order_stepsSteps of each order
tc_mech_vehiclesMileage, wear, options outside props
tc_mech_journalVehicle, order, management and security history
tc_mech_fundsInternal cash box (when no society system)

#Full SQL

Show install.sql (109 lines)
install.sqlDownload
-- tc-mechanic : schema complet / full schema (idempotent, a executer sur la base du serveur)
-- Les tables sont aussi creees automatiquement au demarrage de la ressource (sv_bootstrap.lua lit ce fichier).
-- Tables are also created automatically at resource start (sv_bootstrap.lua reads this file).
-- Ne pas ajouter de point-virgule dans les commentaires / no semicolon inside comments.

CREATE TABLE IF NOT EXISTS `tc_mech_settings` (
    `skey`       VARCHAR(64)  NOT NULL,
    `svalue`     LONGTEXT     NOT NULL,
    `updated_by` VARCHAR(96)  DEFAULT NULL,
    `updated_at` INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`skey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `tc_mech_points` (
    `id`         INT          NOT NULL AUTO_INCREMENT,
    `job`        VARCHAR(64)  NOT NULL,
    `ptype`      VARCHAR(16)  NOT NULL,
    `label`      VARCHAR(64)  NOT NULL,
    `x`          DOUBLE       NOT NULL,
    `y`          DOUBLE       NOT NULL,
    `z`          DOUBLE       NOT NULL,
    `h`          DOUBLE       NOT NULL DEFAULT 0,
    `radius`     FLOAT        NOT NULL DEFAULT 2.5,
    `blip`       TINYINT      NOT NULL DEFAULT 0,
    `enabled`    TINYINT      NOT NULL DEFAULT 1,
    `created_by` VARCHAR(96)  DEFAULT NULL,
    `created_at` INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`),
    KEY `idx_job` (`job`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `tc_mech_orders` (
    `id`             INT          NOT NULL AUTO_INCREMENT,
    `job`            VARCHAR(64)  NOT NULL,
    `otype`          VARCHAR(16)  NOT NULL,
    `status`         VARCHAR(16)  NOT NULL,
    `plate`          VARCHAR(16)  NOT NULL,
    `model`          VARCHAR(32)  NOT NULL DEFAULT '',
    `vehicle_label`  VARCHAR(64)  NOT NULL DEFAULT '',
    `veh_class`      INT          NOT NULL DEFAULT 0,
    `is_bike`        TINYINT      NOT NULL DEFAULT 0,
    `customer_ref`   VARCHAR(64)  NOT NULL DEFAULT '',
    `customer_name`  VARCHAR(96)  NOT NULL DEFAULT '',
    `mechanic_ident` VARCHAR(96)  DEFAULT NULL,
    `mechanic_name`  VARCHAR(96)  DEFAULT NULL,
    `point_id`       INT          DEFAULT NULL,
    `target`         LONGTEXT     NOT NULL,
    `quote_lines`    LONGTEXT     NOT NULL,
    `total`          INT          NOT NULL DEFAULT 0,
    `pay_method`     VARCHAR(12)  DEFAULT NULL,
    `note`           VARCHAR(255) DEFAULT NULL,
    `created_at`     INT          NOT NULL DEFAULT 0,
    `updated_at`     INT          NOT NULL DEFAULT 0,
    `closed_at`      INT          DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_job_status` (`job`, `status`),
    KEY `idx_plate` (`plate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `tc_mech_order_steps` (
    `id`         INT          NOT NULL AUTO_INCREMENT,
    `order_id`   INT          NOT NULL,
    `idx`        INT          NOT NULL,
    `kind`       VARCHAR(12)  NOT NULL,
    `ref`        VARCHAR(32)  NOT NULL,
    `label`      VARCHAR(96)  NOT NULL,
    `data`       LONGTEXT     NOT NULL,
    `status`     VARCHAR(12)  NOT NULL DEFAULT 'pending',
    `done_by`    VARCHAR(96)  DEFAULT NULL,
    `done_at`    INT          DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_order` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `tc_mech_vehicles` (
    `plate`      VARCHAR(16)  NOT NULL,
    `mileage`    DOUBLE       NOT NULL DEFAULT 0,
    `wear`       LONGTEXT     NOT NULL,
    `extras`     LONGTEXT     NOT NULL,
    `updated_at` INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`plate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `tc_mech_journal` (
    `id`          INT          NOT NULL AUTO_INCREMENT,
    `category`    VARCHAR(16)  NOT NULL,
    `job`         VARCHAR(64)  DEFAULT NULL,
    `plate`       VARCHAR(16)  DEFAULT NULL,
    `order_id`    INT          DEFAULT NULL,
    `actor_ident` VARCHAR(96)  DEFAULT NULL,
    `actor_name`  VARCHAR(96)  DEFAULT NULL,
    `action`      VARCHAR(48)  NOT NULL,
    `detail`      TEXT         DEFAULT NULL,
    `mileage`     DOUBLE       DEFAULT NULL,
    `created_at`  INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`),
    KEY `idx_plate` (`plate`),
    KEY `idx_job` (`job`),
    KEY `idx_category` (`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Caisse interne : utilisee uniquement si aucun systeme de societe n'est detecte (Config.Bridge.Society = 'internal')
CREATE TABLE IF NOT EXISTS `tc_mech_funds` (
    `job`        VARCHAR(64)  NOT NULL,
    `balance`    BIGINT       NOT NULL DEFAULT 0,
    `updated_at` INT          NOT NULL DEFAULT 0,
    PRIMARY KEY (`job`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

#Owned vehicles table

The script does not add a vehicles table: it writes final changes into your framework's own, defined in Config.Vehicles:

FrameworkTableProperties column
Visionvehiclesprop (through the core vehicle API, SQL fallback)
ESXowned_vehiclesvehicle
QBCore / Qboxplayer_vehiclesmods

Vehicles must therefore be registered (bought / owned) to be orderable. In standalone, provide Config.Bridge.Standalone.vehicleRow and saveVehicleProps.

Backups

Prices and settings are in tc_mech_settings: include that table in your backups so you do not lose your in-game configuration.

Last updated : 7 November 2026© 2026 TC Script