Jump to content
  • 0

[Question] Using Constraints on the Database


Tepoo

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  104
  • Reputation:   4
  • Joined:  02/06/12
  • Last Seen:  

Hey guys,

i had the following problem on my server.

i created two test accounts with sensless names, created character and logged in. after i saw that it worked, i deleted the accounts in the database login.

i created then two new accounts and logged in. when i was in the character selection i was the chars of the accounts with the sensless names.because i only deleted the accounts.

when i looked up into the tables i saw that you dont use constraints bewteen the keys. is there any restriction in rathena that constraints cant be used? otherwise i would setup my databse with some constraints i think who are usefull.

example: on cascade and delete for account --> character. when an accoiunts gets deleted, delete all entrys who are combined with this accountid.

greetings

Tepoo

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Hey guys,

i had the following problem on my server.

i created two test accounts with sensless names, created character and logged in. after i saw that it worked, i deleted the accounts in the database login.

i created then two new accounts and logged in. when i was in the character selection i was the chars of the accounts with the sensless names.because i only deleted the accounts.

This happened because you truncated the table which resets the auto increment counter. The result is that your newly created accounts has the same IDs as the old ones and became connected to the characters.

when i looked up into the tables i saw that you dont use constraints bewteen the keys. is there any restriction in rathena that constraints cant be used? otherwise i would setup my databse with some constraints i think who are usefull.

example: on cascade and delete for account --> character. when an accoiunts gets deleted, delete all entrys who are combined with this accountid.

greetings

Tepoo

I don't see any problems in doing this.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   285
  • Joined:  12/19/11
  • Last Seen:  

rAthena uses MyISAM tables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...