ensure migration order

This commit is contained in:
Jérémie N'gadi
2020-05-11 22:41:56 +02:00
parent 1d9f33c70a
commit 3ef71f7d35
7 changed files with 19 additions and 28 deletions
-4
View File
@@ -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()
-4
View File
@@ -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()
-4
View File
@@ -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()
-4
View File
@@ -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
-4
View File
@@ -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
+2 -2
View File
@@ -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
View File
@@ -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')