benlau / gogogohk

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

Restore database entry from changelog #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Staff and admin user should be able to restore the record of an entry from
changelog. 

p.s The "restore" action should also be logged in changelog.

Original issue reported on code.google.com by xben...@gmail.com on 26 Aug 2009 at 9:40

GoogleCodeExporter commented 9 years ago
In the current design , changelog save the whole entity. I would like to 
improve it by :

1) Save in JSON (using the code from gaescripts)
2) Save only the different, instead of the whole object.

Any suggestion?

Original comment by xben...@gmail.com on 2 Sep 2009 at 3:13

GoogleCodeExporter commented 9 years ago
1) Save entire object in JSON (using the code from gaescripts)
Will this cost much due to record consumption in GAE? (Does GAE only cost CPU 
usage?)

2) Save only the different, instead of the whole object.
The diff can also be save as JSON ... like { old_attr: old_value, new_attr: 
new_value }
This reduce the datastore consumption...

Original comment by mr.ksc...@gmail.com on 3 Sep 2009 at 3:24

GoogleCodeExporter commented 9 years ago
> Will this cost much due to record consumption in GAE? (Does GAE only cost CPU 
usage?)
yes, as it duplicate the whole entity. 

The first 1G storage in GAE is free of charge. 

> The diff can also be save as JSON ... like { old_attr: old_value, new_attr: 
new_value }

yes , the diff should save in json. I would propose the following format:
[
  { 
    "key" : ...
    "model_kind" : ...
    "old" : {
      ...
    }
    "new" : {
      ...
    }
  },
  {
     .... (next change)
  }
]

Original comment by xben...@gmail.com on 3 Sep 2009 at 6:10

GoogleCodeExporter commented 9 years ago
JSON generation and diff function are finished , I will refactor the database 
to fit
for the changes , but I will not implement restoration at this moment.

Original comment by xben...@gmail.com on 3 Sep 2009 at 6:12