local DatabaseSetup = {}
[Link] = function()
print("[OMNI] 🔄 Initialisation de la base de données...")
local createTableQuery = [[
CREATE TABLE IF NOT EXISTS `accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`license` varchar(255) NOT NULL,
`username` varchar(255) DEFAULT NULL,
`isBanned` tinyint(1) DEFAULT 0,
`banAuthor` text DEFAULT NULL,
`banReason` text DEFAULT NULL,
`banExpires` timestamp NULL DEFAULT NULL,
`hwid` varchar(255) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL,
`lastLogin` timestamp NULL DEFAULT NULL,
`createdAt` timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `license` (`license`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
]]
-- AVEC GESTION D'ERREUR
[Link](createTableQuery, {}, function(rowsChanged)
if rowsChanged then
print("[OMNI] ✅ Table 'accounts' créée ou déjà existante")
else
print("[OMNI] ❌ ERREUR: Échec création table 'accounts'")
end
end)
end
-- ✅ METHODE MODERNE - Utilise l'export MySQL
[Link](function()
local attempts = 0
local maxAttempts = 10
while attempts < maxAttempts do
if MySQL then
print("[OMNI] 📡 Connexion MySQL détectée, initialisation...")
[Link]()
return
else
attempts = attempts + 1
print(("[OMNI] ⏳ Attente MySQL... (%d/%d)"):format(attempts,
maxAttempts))
[Link](1000)
end
end
print("[OMNI] ❌ ERREUR CRITIQUE: MySQL non détecté après " .. maxAttempts .. "
secondes")
end)
return DatabaseSetup