Open tepelekas opened 9 months ago
This fix issue above.
if MySQL.scalar.await("SELECT EXISTS (SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME = 'datastore')") > 0 then
if MySQL.scalar.await("SELECT COUNT(*) FROM datastore WHERE name = 'property'") == 0 then
MySQL.insert("INSERT INTO `datastore` (name, label, shared) VALUES ('property', 'Property', 1)", function(affectedRows)
if affectedRows > 0 then
print("[^2INFO^7] Added ^5Property^7 into ^5datastore^7 table")
end
end)
end
if MySQL.scalar.await("SELECT COUNT(*) FROM datastore_data WHERE name = 'property'") == 0 then
MySQL.insert("INSERT INTO `datastore_data` (name, owner, data) VALUES ('property', NULL, '{}')", function(affectedRows)
if affectedRows > 0 then
print("[^2INFO^7] Added ^5Property^7 into ^5datastore_data^7 table")
end
end)
end
end
I noticed every time my server start's the script esx_property creates a row in my datastore_data table on the database that is empty and null. I tryed and fixed that to check if the row exists then to not create it and create the row only if not exist.
`CreateThread(function() Wait(3000) PropertiesRefresh()
end)`