ESX
Don't Do until any error.
SQL
-- ============================================================================
-- finals_banking — ESX Legacy: example `banker` job (matches `BankerConfig.JobName`)
-- ============================================================================
-- Run on the **same database** as `es_extended`. Adjust column names if your
-- fork’s `jobs` / `job_grades` schema differs (check with HeidiSQL / phpMyAdmin).
--
-- Job **`name`** must match **`BankerConfig.JobName`** in `shared/banker_config.lua`
-- (default **`banker`**).
--
-- Company / society tab access (see `server/society/society_accounts_esx.lua`):
-- • Grade row in `ESX.Jobs[job].grades` with **`isboss`** or **`bankAuth`** = true
-- (only if your ESX build loads those fields from DB or shared config), or
-- • Player’s numeric **`job.grade`** equals that job’s **highest** grade, or
-- • Grade **`name`** listed in **`Config.SocietyBanking.esx.extraBossGradeNames`**
-- (e.g. `{ 'assistant manager', 'branch manager' }` in `shared/config.lua`).
--
-- Stock ESX often only stores `name`, `salary`, skins on `job_grades` — so **top
-- grade (5)** gets company access via the “highest grade” rule. To also allow
-- grade 4 (“Assistant Manager”) without making it the max grade, add both names
-- to **`extraBossGradeNames`** as above, **or** extend your ESX fork to expose
-- **`isboss` / `bankAuth`** on each grade object (QB/ox-style).
-- ============================================================================
-- Optional: wipe existing banker grades before re-seeding (comment out if you already customized).
-- DELETE FROM `job_grades` WHERE `job_name` = 'banker';
INSERT INTO `jobs` (`name`, `label`, `whitelisted`)
VALUES ('banker', 'Bank', 0)
ON DUPLICATE KEY UPDATE
`label` = VALUES(`label`),
`whitelisted` = VALUES(`whitelisted`);
-- If your `jobs` table has a `type` column, add it to the INSERT above, e.g.:
-- INSERT INTO `jobs` (`name`, `label`, `whitelisted`, `type`) VALUES ('banker', 'Bank', 0, 'bank')
-- ON DUPLICATE KEY UPDATE ...
INSERT INTO `job_grades` (`job_name`, `grade`, `name`, `salary`, `skin_male`, `skin_female`) VALUES
('banker', 0, 'Trainee', 50, '{}', '{}'),
('banker', 1, 'Officer', 75, '{}', '{}'),
('banker', 2, 'Senior Officer', 100, '{}', '{}'),
('banker', 3, 'Head', 125, '{}', '{}'),
('banker', 4, 'Assistant Manager', 150, '{}', '{}'),
('banker', 5, 'Branch Manager', 175, '{}', '{}')
ON DUPLICATE KEY UPDATE
`name` = VALUES(`name`),
`salary` = VALUES(`salary`),
`skin_male` = VALUES(`skin_male`),
`skin_female` = VALUES(`skin_female`);
-- If `ON DUPLICATE KEY UPDATE` fails (no unique key on job_name+grade), use one-off DELETE
-- for `job_name` = 'banker' then plain INSERT, or update rows manually.
SQL
-- ESX Legacy / Finals V1: optional tables when `Config.Framework` is `esx_legacy` or `esx_finals_v1`.
-- Primary bank balance stays in `users.accounts` JSON (`bank`). `citizenid` columns here store `users.identifier`.
CREATE TABLE IF NOT EXISTS `finals_banking_esx_account_index` (
`accountId` INT UNSIGNED NOT NULL,
`citizenid` VARCHAR(64) NOT NULL,
`label` VARCHAR(64) NOT NULL DEFAULT 'Primary',
PRIMARY KEY (`accountId`),
UNIQUE KEY `citizenid` (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `finals_banking_esx_extra_accounts` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`citizenid` VARCHAR(64) NOT NULL,
`label` VARCHAR(64) NOT NULL,
`balance` INT NOT NULL DEFAULT 0,
`is_shared` TINYINT(1) NOT NULL DEFAULT 0,
`product_type` VARCHAR(32) NOT NULL DEFAULT 'Savings',
`purpose` VARCHAR(32) NOT NULL DEFAULT 'Personal',
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_esx_extra_c` (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `finals_banking_esx_transactions` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`citizenid` VARCHAR(64) NOT NULL,
`amount` INT NOT NULL,
`direction` ENUM('in','out') NOT NULL,
`kind` VARCHAR(32) NOT NULL,
`message` VARCHAR(255) DEFAULT NULL,
`counterparty` VARCHAR(64) DEFAULT NULL,
`balance_after` INT NOT NULL DEFAULT 0,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_esx_c_created` (`citizenid`,`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL
-- Pending borrower signature before loan disburse (see `server/loan_pending_table.lua` / `banker_qb.lua`).
CREATE TABLE IF NOT EXISTS `finals_banking_loan_pending` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`token` VARCHAR(64) NOT NULL,
`borrower_citizenid` VARCHAR(64) NOT NULL,
`banker_citizenid` VARCHAR(64) NOT NULL,
`lending_society_job` VARCHAR(64) NULL DEFAULT NULL,
`loan_type` VARCHAR(24) NOT NULL,
`principal` INT NOT NULL,
`term_weeks` INT NOT NULL,
`annual_rate` DECIMAL(8,4) NOT NULL,
`total_due` INT NOT NULL,
`weekly_payment` INT NOT NULL,
`periods_total` INT NOT NULL,
`officer_name` VARCHAR(128) NOT NULL,
`officer_signature` LONGTEXT NULL,
`borrower_signature` LONGTEXT NULL,
`borrower_signed_unix` BIGINT UNSIGNED NULL,
`created_unix` BIGINT UNSIGNED NOT NULL,
`expires_unix` BIGINT UNSIGNED NOT NULL,
`status` VARCHAR(24) NOT NULL DEFAULT 'pending',
PRIMARY KEY (`id`),
UNIQUE KEY `token` (`token`),
KEY `idx_borrower` (`borrower_citizenid`,`status`),
KEY `idx_expires` (`status`,`expires_unix`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
SQL
-- Optional: auto-created by resource if missing. Plain PK only (no FK).
-- Wizard fields (Savings/Checking, Personal/Business).
CREATE TABLE IF NOT EXISTS `finals_banking_ui` (
`accountId` INT UNSIGNED NOT NULL,
`productType` VARCHAR(32) NOT NULL DEFAULT 'Savings',
`purpose` VARCHAR(32) NOT NULL DEFAULT 'Personal',
PRIMARY KEY (`accountId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `finals_banking_card_atm` (
`account_id` BIGINT UNSIGNED NOT NULL,
`atm_blocked` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;