View Single Post
  #12  
Old 12-29-2010, 03:01 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Quote:
Originally Posted by Fasthand View Post
can we change db rules for no duplicate or if exist update instead of default adding ?
char_id is the primary key for the guild_members table. There should be no way MySQL will allow duplicate entries:
Code:
mysql> describe guild_members;
+----------------+-----------------------+------+-----+---------+-------+
| Field          | Type                  | Null | Key | Default | Extra |
+----------------+-----------------------+------+-----+---------+-------+
| char_id        | int(11)               | NO   | PRI | 0       |       |
| guild_id       | mediumint(8) unsigned | NO   |     | 0       |       |
| rank           | tinyint(3) unsigned   | NO   |     | 0       |       |
| tribute_enable | tinyint(3) unsigned   | NO   |     | 0       |       |
| total_tribute  | int(10) unsigned      | NO   |     | 0       |       |
| last_tribute   | int(10) unsigned      | NO   |     | 0       |       |
| banker         | tinyint(3) unsigned   | NO   |     | 0       |       |
| public_note    | text                  | NO   |     | NULL    |       |
| alt            | tinyint(3) unsigned   | NO   |     | 0       |       |
+----------------+-----------------------+------+-----+---------+-------+
9 rows in set (0.00 sec)
Code:
mysql> insert into guild_members(`char_id`) values(1234);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> insert into guild_members(`char_id`) values(1234);
ERROR 1062 (23000): Duplicate entry '1234' for key 1
EDIT: Must be something to do with changes required for bots. I see this in bots.sql
Code:
ALTER TABLE `guild_members` DROP PRIMARY KEY;

Last edited by Derision; 12-29-2010 at 03:10 PM..
Reply With Quote