Menu

#44 Fix datagrid column handling

open-accepted
None
5
2010-09-24
2010-09-22
No

Plomino should be able to cope if columns are added or removed on a datagrid field.
How?
Padding at the end will cause corruption if the new column was added in the middle.
Chopping would cause data loss or invisible orphaning if a column was removed.

How about if columns are swapped? Old docs have ['debit', 'credit'], new docs have ['credit', 'debit'], now old docs are telling me that you owe me what I owe you.

Discussion

  • Jean Jordaan

    Jean Jordaan - 2010-09-22
    • assigned_to: nobody --> ebrehault
     
  • Jean Jordaan

    Jean Jordaan - 2010-09-22

    The only route is to require a fix of existing documents.
    If columns on a datagrid are edited, then a flag should be set on the database: "DANGER WILL ROBINSON .. DOCUMENTS IN INDETERMINATE STATE".
    Best would be if the datagrid field allowed you to specify old/new column mapping and could find and update existing docs.

     
  • Eric Brehault

    Eric Brehault - 2010-09-23

    last Plomino rev on trunk fix this problem
    now, datagrid arrays are resized (shortened or extended) depending on the number of columns declared in the field settings

     
  • Eric Brehault

    Eric Brehault - 2010-09-23
    • status: open --> closed-fixed
     
  • Jean Jordaan

    Jean Jordaan - 2010-09-23

    Fixed?

    Padding at the end will cause corruption if the new column was added in the middle.
    Chopping would cause data loss or invisible orphaning if a column was removed.

    How about if columns are swapped? Old docs have ['debit', 'credit'], new docs have ['credit', 'debit'], now old docs are telling me that you owe me what I owe you.

     
  • Eric Brehault

    Eric Brehault - 2010-09-24

    ok right, I see your point
    I re-open the bug then, but I do not have any immediate solution for now

    a conversion mechanism would be nice of course,
    nevertheless I am not sure it is needed: imagine a Date field where format is %Y/%m/%D %H:%M
    you change it to %Y/%m/%D, next time you save a doc, you will loose the hour and minute values
    basically, changing design may break some data in your documents, so if you change the design, you have to take care of the existing data, and fix them with an agent if needed

    but I agree a warning mechanism would be good

    note: as I said, I am not opposed to a conversion mechanism, I just do not figure how it could be implemented in an ergonomic and user-friendly way in the current Settings tab

     
  • Eric Brehault

    Eric Brehault - 2010-09-24
    • status: closed-fixed --> open-accepted
     
  • Jean Jordaan

    Jean Jordaan - 2010-09-24

    I have no easy answer either! Plomino currently doesn't offer safety nets. Perhaps a warning which links to a "document migration" note at plomino.net is best for now.

     

Log in to post a comment.

MongoDB Logo MongoDB