aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-01-22 16:57:56 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2012-02-23 23:44:13 +0100
commit15821817015868b370a5a1bf52452bd8d3c96317 (patch)
tree868eaafd23a123cf135619a000ef88ea60bd07dc
parent572d4f01ff3bee75574c00bc85bc8a2700ba9828 (diff)
downloadmediagoblin-15821817015868b370a5a1bf52452bd8d3c96317.tar.lz
mediagoblin-15821817015868b370a5a1bf52452bd8d3c96317.tar.xz
mediagoblin-15821817015868b370a5a1bf52452bd8d3c96317.zip
mongo to sql convert: Better Ordering
Order the conversion by the "created" attribute. That way the sql ids are mostly in the order they would have been, if sql was used earlier. Makes things nicer to look at in a db dump.
-rw-r--r--mediagoblin/db/sql/convert.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py
index 36d6fc7f..f5c93af5 100644
--- a/mediagoblin/db/sql/convert.py
+++ b/mediagoblin/db/sql/convert.py
@@ -49,7 +49,7 @@ def copy_reference_attr(entry, new_entry, ref_attr):
def convert_users(mk_db):
session = Session()
- for entry in mk_db.User.find():
+ for entry in mk_db.User.find().sort('created'):
print entry.username
new_entry = User()
@@ -71,7 +71,7 @@ def convert_users(mk_db):
def convert_media_entries(mk_db):
session = Session()
- for entry in mk_db.MediaEntry.find():
+ for entry in mk_db.MediaEntry.find().sort('created'):
print repr(entry.title)
new_entry = MediaEntry()
@@ -100,7 +100,7 @@ def convert_media_tags(mk_db):
session = Session()
session.autoflush = False
- for media in mk_db.MediaEntry.find():
+ for media in mk_db.MediaEntry.find().sort('created'):
print repr(media.title)
for otag in media.tags:
@@ -127,7 +127,7 @@ def convert_media_tags(mk_db):
def convert_media_comments(mk_db):
session = Session()
- for entry in mk_db.MediaComment.find():
+ for entry in mk_db.MediaComment.find().sort('created'):
print repr(entry.content)
new_entry = MediaComment()