mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
Revert "refactor: only store migrations if not ran"
This reverts commit 45308f5d49.
This commit is contained in:
@@ -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(*)
|
||||
|
||||
Reference in New Issue
Block a user