it contains value thats what it says. You said where ever you want, so its in player_id whats the issueWhere ever you want it to be.
"read up what a primary key does in databases."
You setting it to player_id, means player_id must be a unique value.It must contain a unique value for each row of data.
so has to be like this?If you had actually looked it up, you would see the issue.
You setting it to player_id, means player_id must be a unique value.
You can put a primary key pretty much where ever you want. but the data in it must be unique.
As you are wanting multiple deaths per character setting player_id as primary key clearly isn't the right solution for this table.
so maybe at killed_by should be primary key and unique?If I run into an area on a level 1000 mage and kill 10 level 8's in 1 hit.
They will all die at the same time. So no.
in other tables they have id as primary, so idkCoding isn't just about reusing people's codes and databases. Sometimes its about thinking outside the box.
Databases don't need primary keys but its highly recommended.
Look at your other tables and see what they use as unique identifiers or primary keys
local playerGuid = player:getGuid()
print("SLAW-DEBUG:" .. playerGuid .. ", " .. os.time() .. ", " .. player:getLevel() .. ", " .. db.escapeString(killerName) .. ", " .. byPlayer .. ", " .. db.escapeString(mostDamageName) .. ", " .. byPlayerMostDamage .. ", " .. (unjustified and 1 or 0) .. ", " .. (mostDamageUnjustified and 1 or 0) .. ")")
You can only have a unique value as primary key.
So if player ID is set as primary key, in the players_deaths there will only ever be 1 entry for that user as this is the unique id (primary key) and cannot be any more entries.
I was trying to let him come to the conclusion himself. Teach a man to fish and all that.
I understand, but he is using original SQL table from TFS, and also almost unmodified script. So the reason needs to be somewhere else.
well i cant remove primary key anymore so -_-"id" not player_id.
or none at all
forgottenserver/schema.sql at master · otland/forgottenserver
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
player_deaths
DROP PRIMARY KEY;It's definitely a database issue.Didnt solved the issue, still shows only one death so its not db anymore
player_id
, you're forcing the database to have a single entry of that player.Thats exactally how it isIt's definitely a database issue.
By default, there is 5 player deaths listed in the database, per character. (regulated by your lua script)
But since your database, for whatever reason, has a primary key onplayer_id
, you're forcing the database to have a single entry of that player.
Remove the primary key restriction in player_deaths, and your issue will go away.
View attachment 62437
remove the index fromThats exactally how it is
time
as wellremove the index fromtime
as well
I think you added the index to time at some point while testing other solutions.
It shouldn't be there.