mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
ensure migration order
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
local self = ESX.Modules['addonaccount']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('addonaccount')
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_addonaccount:getAccount', function(name, owner, cb)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
local self = ESX.Modules['addoninventory']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('addoninventory')
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_addoninventory:getInventory', function(name, owner, cb)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
local self = ESX.Modules['datastore']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('datastore')
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_datastore:getDataStore', function(name, owner, cb)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
local self = ESX.Modules['job_police']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('job_police')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_policejob:confiscatePlayerItem')
|
||||
AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType, itemName, amount)
|
||||
local _source = source
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
local self = ESX.Modules['society']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('society')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_addonaccount:setMoney')
|
||||
AddEventHandler('esx_addonaccount:setMoney', function(society, money)
|
||||
if ESX.PlayerData.job and ESX.PlayerData.job.grade_name == 'boss' and 'society_' .. ESX.PlayerData.job.name == society then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ESX.EnsureMigrations = function(module)
|
||||
|
||||
print('[esx] migrate => ' .. module)
|
||||
print('[esx] ensure migrations => ' .. module)
|
||||
|
||||
local dir
|
||||
|
||||
@@ -47,7 +47,7 @@ ESX.EnsureMigrations = function(module)
|
||||
until sql == nil
|
||||
|
||||
if not hasmigrated then
|
||||
print('[esx] [' .. module .. '] => no pending migration')
|
||||
-- print('[esx] [' .. module .. '] => no pending migration')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
+17
-6
@@ -2,14 +2,25 @@ MySQL.ready(function()
|
||||
|
||||
print('[esx] ensuring migrations')
|
||||
|
||||
TriggerEvent('esx:migrations:ensure', function(module)
|
||||
ESX.EnsureMigrations(module)
|
||||
end)
|
||||
local index = 0
|
||||
local results = {}
|
||||
local start
|
||||
local manifest = LoadResourceFile(GetCurrentResourceName(), 'fxmanifest.lua')
|
||||
|
||||
end)
|
||||
repeat
|
||||
|
||||
start, index = manifest:find("esxmodule '.-'", index)
|
||||
|
||||
if start then
|
||||
|
||||
local module = manifest:sub(start, index):sub(12):sub(0, -2)
|
||||
|
||||
ESX.EnsureMigrations(module)
|
||||
|
||||
end
|
||||
|
||||
until not start
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('base')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:onPlayerJoined')
|
||||
|
||||
Reference in New Issue
Block a user