Make modern versions of our old backup/load scripts.

Review Request #2669 — Created Oct. 22, 2011 and submitted

Information

Review Board
release-1.6.x

Reviewers

Make modern versions of our old backup/load scripts.

The DB backup/load scripts are still around, but don't cover all models.
It's worth fixing up, since they can be useful when moving from sqlite
to something else.

They've been moved to be management commands now. This will be made
available to 1.6.
Did some sample backups and loads of my DB. I think it got everything.
Description From Last Updated

This should point out that it dumps to stdout.

daviddavid

This should be a list comprehension: models = [get_models(app) for app in get_apps()]

daviddavid

It would be nice to only count these once. counts = [model.objects.count() for model in models] for model, count in …

daviddavid

Doesn't need ()s

daviddavid

These can be combined

daviddavid
david
  1. 
      
  2. Show all issues
    This should point out that it dumps to stdout.
  3. reviewboard/admin/management/commands/dumpdb.py (Diff revision 1)
     
     
     
     
     
    Show all issues
    This should be a list comprehension:
    
    models = [get_models(app) for app in get_apps()]
    1. Extending, not appending.
  4. Show all issues
    It would be nice to only count these once.
    
    counts = [model.objects.count() for model in models]
    for model, count in zip(models, counts):
        ...
    1. It's still a query per count. I don't think it makes any difference? It's just a question of do we do the queries all up-front, or when it comes time to serialize the model.
  5. Show all issues
    Doesn't need ()s
  6. Show all issues
    These can be combined
  7. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.6.x (7fe956a06a114e44cfdb5291a2059805d3ca01a6)
Loading...