diff options
author | Jef van Schendel <jefvanschendel@gmail.com> | 2011-06-28 13:50:05 +0200 |
---|---|---|
committer | Jef van Schendel <jefvanschendel@gmail.com> | 2011-06-28 13:50:05 +0200 |
commit | a4e4d775485f51eb4a2c3c30c624bd364b0c6504 (patch) | |
tree | dd7424c094fac35a2b3e3f33f75d06f4f494261b /mediagoblin/gmg_commands/migrate.py | |
parent | 664682aaf6d61029b4e6d1c336b294cff93059a5 (diff) | |
parent | 2527754202ea9530c9046270e63d71581923dc77 (diff) | |
download | mediagoblin-a4e4d775485f51eb4a2c3c30c624bd364b0c6504.tar.lz mediagoblin-a4e4d775485f51eb4a2c3c30c624bd364b0c6504.tar.xz mediagoblin-a4e4d775485f51eb4a2c3c30c624bd364b0c6504.zip |
Merge remote-tracking branch 'gitorious/master'
Diffstat (limited to 'mediagoblin/gmg_commands/migrate.py')
-rw-r--r-- | mediagoblin/gmg_commands/migrate.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mediagoblin/gmg_commands/migrate.py b/mediagoblin/gmg_commands/migrate.py index 9e01d51c..ab1a267b 100644 --- a/mediagoblin/gmg_commands/migrate.py +++ b/mediagoblin/gmg_commands/migrate.py @@ -16,6 +16,7 @@ from mediagoblin.db import migrations +from mediagoblin.db import util as db_util from mediagoblin.gmg_commands import util as commands_util @@ -27,8 +28,17 @@ def migrate_parser_setup(subparser): def migrate(args): mgoblin_app = commands_util.setup_app(args) - print "Applying migrations..." + # Clear old indexes + print "== Clearing old indexes... ==" + removed_indexes = db_util.remove_deprecated_indexes(mgoblin_app.db) + + for collection, index_name in removed_indexes: + print "Removed index '%s' in collection '%s'" % ( + index_name, collection) + + # Migrate + print "== Applying migrations... ==" for model_name in migrations.MIGRATE_CLASSES: model = getattr(mgoblin_app.db, model_name) @@ -38,4 +48,10 @@ def migrate(args): migration = model.migration_handler(model) migration.migrate_all(collection=model.collection) - print "... done." + # Add new indexes + print "== Adding new indexes... ==" + new_indexes = db_util.add_new_indexes(mgoblin_app.db) + + for collection, index_name in new_indexes: + print "Added index '%s' to collection '%s'" % ( + index_name, collection) |