From 6c50d2261506fef5cd1a3aafb61808477a0370e6 Mon Sep 17 00:00:00 2001 From: Selt <83926739+seltonmt012@users.noreply.github.com> Date: Tue, 28 Jul 2026 03:06:20 +0200 Subject: [PATCH 1/2] fix(es_extended): widen billing.target to hold an identifier The column is varchar(40) but esx_billing writes an identifier into it, and those are 46 characters once multicharacter is on, so the insert fails with 1406 and the handler dies before notifying either player. The other two identifier columns in the same table are already varchar(60). --- [SQL]/legacy.sql | 2 +- .../v1.14.2/billingTargetLength/main.lua | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 [core]/es_extended/server/migration/v1.14.2/billingTargetLength/main.lua diff --git a/[SQL]/legacy.sql b/[SQL]/legacy.sql index 05d5d10b..4e38f100 100644 --- a/[SQL]/legacy.sql +++ b/[SQL]/legacy.sql @@ -89,7 +89,7 @@ CREATE TABLE `billing` ( `identifier` varchar(60) NOT NULL, `sender` varchar(60) NOT NULL, `target_type` varchar(50) NOT NULL, - `target` varchar(40) NOT NULL, + `target` varchar(60) NOT NULL, `label` varchar(255) NOT NULL, `amount` int(11) NOT NULL ) ENGINE=InnoDB; diff --git a/[core]/es_extended/server/migration/v1.14.2/billingTargetLength/main.lua b/[core]/es_extended/server/migration/v1.14.2/billingTargetLength/main.lua new file mode 100644 index 00000000..f7699a60 --- /dev/null +++ b/[core]/es_extended/server/migration/v1.14.2/billingTargetLength/main.lua @@ -0,0 +1,41 @@ +local esxVersion = "v1.14.2" + +Core.Migrations = Core.Migrations or {} +Core.Migrations[esxVersion] = Core.Migrations[esxVersion] or {} + +if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) == 1 then + return +end + +---@return boolean restartRequired +Core.Migrations[esxVersion].billingTargetLength = function() + print("^4[esx_migration:v1.14.2:billingTargetLength]^7 Checking the length of billing.target.") + + local length = MySQL.scalar.await([[ + SELECT CHARACTER_MAXIMUM_LENGTH + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = 'billing' + AND COLUMN_NAME = 'target' + ]]) + + if not length then + print("^4[esx_migration:v1.14.2:billingTargetLength]^7 Column not found, migration not needed.") + return false + end + + if length >= 60 then + print(("^4[esx_migration:v1.14.2:billingTargetLength]^7 Column is already varchar(%s), migration not needed."):format(length)) + return false + end + + print(("^4[esx_migration:v1.14.2:billingTargetLength]^7 Column is varchar(%s), widening it to 60."):format(length)) + + MySQL.update.await([[ + ALTER TABLE `billing` + MODIFY `target` VARCHAR(60) NOT NULL + ]]) + + print("^4[esx_migration:v1.14.2:billingTargetLength]^7 Migration complete.") + return true +end From ad195a65165f8e040f24967f7a1543f1ca348217 Mon Sep 17 00:00:00 2001 From: Selt <83926739+seltonmt012@users.noreply.github.com> Date: Thu, 30 Jul 2026 00:51:15 +0200 Subject: [PATCH 2/2] fix(es_extended): widen rented_vehicles.owner to hold an identifier The column is varchar(22), which is a leftover from Steam identifiers. esx_vehicleshop writes a player identifier into it, and on a multicharacter server those are 46 characters long, so renting a vehicle out fails. The stock vehicle is deleted from cardealer_vehicles before the insert runs, so the dealer loses the car and the customer never gets a rental contract. Neither side is told anything, because the handler dies on the insert. esx_vehicleshop's own esx_vehicleshop.sql already declares varchar(60). --- [SQL]/legacy.sql | 2 +- .../rentedVehiclesOwnerLength/main.lua | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 [core]/es_extended/server/migration/v1.14.2/rentedVehiclesOwnerLength/main.lua diff --git a/[SQL]/legacy.sql b/[SQL]/legacy.sql index 4e38f100..51ad2f2e 100644 --- a/[SQL]/legacy.sql +++ b/[SQL]/legacy.sql @@ -364,7 +364,7 @@ CREATE TABLE `rented_vehicles` ( `player_name` varchar(255) NOT NULL, `base_price` int(11) NOT NULL, `rent_price` int(11) NOT NULL, - `owner` varchar(22) NOT NULL + `owner` varchar(60) NOT NULL ) ENGINE=InnoDB; -- diff --git a/[core]/es_extended/server/migration/v1.14.2/rentedVehiclesOwnerLength/main.lua b/[core]/es_extended/server/migration/v1.14.2/rentedVehiclesOwnerLength/main.lua new file mode 100644 index 00000000..74518e11 --- /dev/null +++ b/[core]/es_extended/server/migration/v1.14.2/rentedVehiclesOwnerLength/main.lua @@ -0,0 +1,41 @@ +local esxVersion = "v1.14.2" + +Core.Migrations = Core.Migrations or {} +Core.Migrations[esxVersion] = Core.Migrations[esxVersion] or {} + +if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) == 1 then + return +end + +---@return boolean restartRequired +Core.Migrations[esxVersion].rentedVehiclesOwnerLength = function() + print("^4[esx_migration:v1.14.2:rentedVehiclesOwnerLength]^7 Checking the length of rented_vehicles.owner.") + + local length = MySQL.scalar.await([[ + SELECT CHARACTER_MAXIMUM_LENGTH + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = 'rented_vehicles' + AND COLUMN_NAME = 'owner' + ]]) + + if not length then + print("^4[esx_migration:v1.14.2:rentedVehiclesOwnerLength]^7 Column not found, migration not needed.") + return false + end + + if length >= 60 then + print(("^4[esx_migration:v1.14.2:rentedVehiclesOwnerLength]^7 Column is already varchar(%s), migration not needed."):format(length)) + return false + end + + print(("^4[esx_migration:v1.14.2:rentedVehiclesOwnerLength]^7 Column is varchar(%s), widening it to 60."):format(length)) + + MySQL.update.await([[ + ALTER TABLE `rented_vehicles` + MODIFY `owner` VARCHAR(60) NOT NULL + ]]) + + print("^4[esx_migration:v1.14.2:rentedVehiclesOwnerLength]^7 Migration complete.") + return true +end