refactor: only store migrations if not already ran

This commit is contained in:
Kenshin13
2025-08-25 01:15:30 +02:00
parent ff8798a441
commit 8fad1f94ed
2 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ for esxVersion, migrations in pairs(Core.Migrations or {}) do
---@cast esxVersion string
---@cast migrations table<string, function>
if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) ~= 1 then
if ESX.Table.SizeOf(migrations) > 0 then
print(("^4[INFO]^7 Running migrations for ESX version %s"):format(esxVersion))
for migrationName, migration in pairs(migrations) do
@@ -1,7 +1,13 @@
Core.Migrations = Core.Migrations or {}
Core.Migrations["v1.13.3"] = Core.Migrations["v1.13.3"] or {}
local esxVersion = "v1.13.3"
Core.Migrations["v1.13.3"].ssn = function()
Core.Migrations = Core.Migrations or {}
Core.Migrations[esxVersion] = Core.Migrations[esxVersion] or {}
if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) == 1 then
return
end
Core.Migrations[esxVersion].ssn = function()
print("^4[esx_migration:v.1.13.3:ssn]^7 Adding SSN column to users table.")
local col = MySQL.scalar.await([[
SELECT COUNT(*)