weixin_39782500 2020-11-22 01:58
浏览 0

[patch] is list

after I had quite some trouble with dm-is-list on production (table with > 10000 entries which had more then 100 double positions - no scope) I needed to change the implementation that I can set some unique constraints on position/scope which at least helps to keep my database consistence.

the patch allows these constraints and along I fixed the 'move :up/:down' to respect the scope. the behaviour of switching the scope without supplying a new position is now the same as inserting a new entry in that new scope, i.e. it will be put at the end of the list.

the tests got the unique constraints.

the problem with my big table was something with such update statements:

 sql
UPDATE "items" SET "position" = "position" + 1 WHERE "position" BETWEEN 4 AND 7

where it looks like that these are split up into a sequence of several statements which could interfere with each other. I never managed to reproduce the error in a test case, but it was reproducable on production and the new implementation works.

regards Kristian

Created by kristian - 2009-06-07 10:27:54 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/891

该提问来源于开源项目:datamapper/dm-core

  • 写回答

18条回答 默认 最新

  • weixin_39782500 2020-11-22 01:58
    关注

    : Can you update this patch against the dm-more/next branch?

    Also, one reason for the problem you are seeing is that when you have a unique constraint on the position column, and you don’t supply an ORDER BY statement to MySQL it can explode if the positions are changed in the wrong order internally by MySQL.

    by Dan Kubb (dkubb)

    评论

报告相同问题?