mehov / mooha

Automatically exported from code.google.com/p/mooha
1 stars 0 forks source link

Primary key in mooha_map #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Syncing with more than 2 clients 
2.
3.

What version of the product are you using? On what operating system?0.10., 
but the error is also in 0.20 i guess 

Please provide any additional information below.

CREATE TABLE IF NOT EXISTS `mooha_map` (
  `user_id` int(10) unsigned NOT NULL,
  `db_id` int(10) unsigned NOT NULL,
  `client` varchar(256) NOT NULL default '',
  `client_item_id` varchar(128) NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  PRIMARY KEY  (`item_id`)
)

One Item can have more than one mapping. So, item_id should not be primary 
key alone. PRIMARY KEY should be (`item_id`, 'client'). I think this i a 
failure, or are there special intentions behind that?

Original issue reported on code.google.com by c.schwie...@gmail.com on 25 Mar 2010 at 2:14

GoogleCodeExporter commented 9 years ago
Thanks for the report!
Indeed Indexes should be corrected with this query:

ALTER TABLE `mooha_anchors` ADD PRIMARY KEY (`db_id`, `client`);
ALTER TABLE `mooha_map` DROP PRIMARY KEY;
ALTER TABLE `mooha_map` ADD PRIMARY KEY (`user_id`, `db_id`, `client`,
`client_item_id`, `item_id`);

On some systems it can fail with MySQL error: #1071 - Specified key was too 
long...
Right now I don't know how to overcome this, may be you can help?

Original comment by artico.b...@gmail.com on 30 Mar 2010 at 6:20

GoogleCodeExporter commented 9 years ago
Please use mooha_sql_patch0.21b_for0.2b.sql to fix this issue.

Original comment by artico.b...@gmail.com on 3 Apr 2010 at 6:37

Attachments: