Business owner bugged
#1

Hello there, im currently running a server for like 2-3 weeks and the business system was working okay but now a bug just showed up , when an admin does /mybusinesses it shows him all existing businesses not the one that he owns ( that what cmd is meant to show) , i checked out the databases and saw that at "Owner table" the name was not saving as "NoBody" if there was no owner but as blank space " " , how can i check this shit out to fix it i got no idea
Reply
#2

Alter your table and modify the column's default value to 'NoBody'.
pawn Код:
ALTER `table` MODIFY 'buis_owner_column` VARCHAR(25) NOT NULL DEFAULT 'NoBody'
You should also restart your server once a week to make sure things are going well.

PS : It's better to use foreign keys than storing plain names.
Reply
#3

It was defined as "Null" but i think the problem is coming from SaveBusiness stock.
is there a way i could debug so i can find out whats the matter ?
Reply
#4

To do it properly the "owner" column should store the id of the player that owns it, not their name. If there isn't an owner then that column should be null.

The importance of proper foreign keys only surfaces the moment a player's name changes or the player's account gets deleted in its entirety. Your artificial relation is suddenly broken and you are left with what are known as "orphaned rows" which are a mess to clean up.

Whereas with proper relations a name change doesn't affect anything because it is only stored in one place and if a user is deleted the database engine automatically does a cleanup, e.g. removing that player as the owner from any businesses.
Reply
#5

So you saying to store the playerid as owner and not their name ?
i also have "SQLID" on my player database and i was thinking to make it for owner instant of players name because that sqlid never changes even if the player has changed the name or did anything
Reply
#6

Quote:
Originally Posted by ThatFag
Посмотреть сообщение
So you saying to store the playerid as owner and not their name ?
i also have "SQLID" on my player database and i was thinking to make it for owner instant of players name because that sqlid never changes even if the player has changed the name or did anything
Not the playerid because it changes. You can use th "SQLID" data as a reference on business table.
Reply
#7

Deleted
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)