Revert "refactor: only store migrations if not ran"

This reverts commit 45308f5d49.
This commit is contained in:
Kenshin13
2025-08-24 17:39:16 +02:00
committed by _Not_
parent cb4206a21f
commit 8eac8cf9fc
2 changed files with 13 additions and 17 deletions
+11 -9
View File
@@ -16,18 +16,20 @@ for esxVersion, migrations in pairs(Core.Migrations or {}) do
---@cast esxVersion string
---@cast migrations table<string, function>
print(("^4[INFO]^7 Running migrations for ESX version %s"):format(esxVersion))
if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) ~= 1 then
print(("^4[INFO]^7 Running migrations for ESX version %s"):format(esxVersion))
for migrationName, migration in pairs(migrations) do
local success, err = pcall(migration)
if not success then
error(("^1[ERROR]^7 Failed migration ^4['%s.%s']^7: %s"):format(esxVersion, migrationName, err))
for migrationName, migration in pairs(migrations) do
local success, err = pcall(migration)
if not success then
error(("^1[ERROR]^7 Failed migration ^4['%s.%s']^7: %s"):format(esxVersion, migrationName, err))
end
end
end
SetResourceKvpInt(("esx_migration:%s"):format(esxVersion), 1)
print(("^2[SUCCESS]^7 Successfully completed migrations for ESX version %s"):format(esxVersion))
migrationsRan += 1
SetResourceKvpInt(("esx_migration:%s"):format(esxVersion), 1)
print(("^2[SUCCESS]^7 Successfully completed migrations for ESX version %s"):format(esxVersion))
migrationsRan += 1
end
end
if migrationsRan > 0 then
@@ -1,13 +1,7 @@
local esxVersion = "v1.13.3"
if GetResourceKvpInt(("esx_migration:%s"):format(esxVersion)) == 1 then
return
end
Core.Migrations = Core.Migrations or {}
Core.Migrations[esxVersion] = Core.Migrations[esxVersion] or {}
Core.Migrations["v1.13.3"] = Core.Migrations["v1.13.3"] or {}
Core.Migrations[esxVersion].ssn = function()
Core.Migrations["v1.13.3"].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(*)