diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-27 20:05:01 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-27 20:05:01 -0500 |
commit | 8db03585a22904404543fe324c2c06b90471aed8 (patch) | |
tree | fc98ca03171b2a5ed202e4d78239425afdefe400 | |
parent | b1db6f20dd3cdef9da9ad27513aeee2738c85262 (diff) | |
download | mediagoblin-8db03585a22904404543fe324c2c06b90471aed8.tar.lz mediagoblin-8db03585a22904404543fe324c2c06b90471aed8.tar.xz mediagoblin-8db03585a22904404543fe324c2c06b90471aed8.zip |
Updating migrate.py to actually run the indexing commands
-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) |