diff --git a/server/modules/database.lua b/server/modules/database.lua index 5ed2a00..a656692 100644 --- a/server/modules/database.lua +++ b/server/modules/database.lua @@ -11,7 +11,7 @@ local db = {} ---@param {string} data.vehicleName - A name of the vehicle. db.addVehicle = function(data) - return MySQL.insert.await('INSERT INTO owned_vehicles (`owner`, `plate`, `vehicle`, `stored`, `type`) VALUES (?, ?, ?, ?, ?)', {data.identifier, data.plate, data.properties, not hasFreeCoords, data.vehicleType}) + return MySQL.insert.await('INSERT INTO owned_vehicles (`owner`, `plate`, `vehicle`, `stored`, `type`, `name`) VALUES (?, ?, ?, ?, ?, ?)', {data.identifier, data.plate, data.properties, not hasFreeCoords, data.vehicleType, data.vehicleName}) end db.select = function(query, params) diff --git a/server/server.lua b/server/server.lua index d4ee47d..3d5b66f 100644 --- a/server/server.lua +++ b/server/server.lua @@ -13,6 +13,23 @@ local function initializedThread() return end + + result = MySQL.query.await(('SHOW COLUMNS FROM `%s`'):format(Config.vehicleTable, {indent=true})) + local nameField = false + + for i = 1, #result do + if result[i].Field == 'name' then + nameField = true + end + end + + if not nameField then + dprint(('Inserting `nameField` in `%s`'):format(Config.vehicleTable)) + MySQL.query(('ALTER TABLE `%s` ADD COLUMN `name` VARCHAR(40) DEFAULT `Unknown`'):format(Config.vehicleTable)) + end + + + print('$$\\ $$$$$$\\ $$$$$$$\\ $$$$$$$\\ ') print('$$ | $$ __$$\\$$ __$$\\$$ __$$\\ ') print('$$ | $$ / \\__$$ | $$ $$ | $$ |') diff --git a/shared/config.lua b/shared/config.lua index 6e01c3b..1c5ab46 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -2,11 +2,12 @@ Config = {} --[[ Main section ]]-- Config.debug = true -Config.useFrontEndSounds = true -- Whether you want usage of sound fx -Config.cacheIndexes = true -- Menu select indexes will save upon closing menu -Config.menuPosition = 'right' -- OX Menu pos -Config.textDistance = 1.0 -- Text UI distance -Config.notifDuration = 10000 -- Default notif duration +Config.vehicleTable = "owned_vehicles" +Config.useFrontEndSounds = true -- Whether you want usage of sound fx +Config.cacheIndexes = true -- Menu select indexes will save upon closing menu +Config.menuPosition = 'right' -- OX Menu pos +Config.textDistance = 1.0 -- Text UI distance +Config.notifDuration = 10000 -- Default notif duration Config.oxTarget = false Config.logging = 'https://discord.com/api/webhooks/1168648895203639306/7HgonEmJVPWhPpmwjef869ajO6dH5eYQWG3PhbFo8on3o223w1aNlie7JzdPlJkT5xv5' -- oxlogger or 'YOUR_WEBHOOK'