refactor: store migrations in core table

This commit is contained in:
Kenshin13
2025-08-24 17:33:10 +02:00
parent 5cb6f35b11
commit 22ab3dc8df
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ RegisterCommand("resetmigrations", function(src)
return return
end end
for version, _ in pairs(Migrations or {}) do for version, _ in pairs(Core.Migrations or {}) do
DeleteResourceKvp(("esx_migration:%s"):format(version)) DeleteResourceKvp(("esx_migration:%s"):format(version))
end end
print("^2[SUCCESS]^7 Reset all migrations. This will re-run all migrations on the next server start.") print("^2[SUCCESS]^7 Reset all migrations. This will re-run all migrations on the next server start.")
@@ -12,7 +12,7 @@ end)
local migrationsRan = 0 local migrationsRan = 0
for esxVersion, migrations in pairs(Migrations or {}) do for esxVersion, migrations in pairs(Core.Migrations or {}) do
---@cast esxVersion string ---@cast esxVersion string
---@cast migrations table<string, function> ---@cast migrations table<string, function>
@@ -1,7 +1,7 @@
Migrations = Migrations or {} Core.Migrations = Core.Migrations or {}
Migrations["v1.13.3"] = Migrations["v1.13.3"] or {} Core.Migrations["v1.13.3"] = Core.Migrations["v1.13.3"] or {}
Migrations["v1.13.3"].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.") print("^4[esx_migration:v.1.13.3:ssn]^7 Adding SSN column to users table.")
local col = MySQL.scalar.await([[ local col = MySQL.scalar.await([[
SELECT COUNT(*) SELECT COUNT(*)