Wrote some (semi-silly) descriptions of each migration
[mediagoblin.git] / mediagoblin / tests / test_migrations.py
index 127b90e1d9dd8d3683bf6f805e76dd52ef02572e..8e573f5a21d20a41e29ec621e22476cc465ce7db 100644 (file)
@@ -1,5 +1,5 @@
 # GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 Free Software Foundation, Inc
+# Copyright (C) 2011 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -20,9 +20,10 @@ from pymongo import Connection
 
 from mediagoblin.tests.tools import (
     install_fixtures_simple, assert_db_meets_expected)
-from mediagoblin.db.util import (
+from mediagoblin.db.mongo.util import (
     RegisterMigration, MigrationManager, ObjectId,
     MissingCurrentMigration)
+from mediagoblin.db.mongo.migrations import add_table_field
 
 # This one will get filled with local migrations
 TEST_MIGRATION_REGISTRY = {}
@@ -42,12 +43,10 @@ def creature_add_magical_powers(database):
     Add lists of magical powers.
 
     This defaults to [], an empty list.  Since we haven't declared any
-    magical powers, all existing monsters should
+    magical powers, all existing monsters, setting to an empty list is
+    fine.
     """
-    database['creatures'].update(
-        {'magical_powers': {'$exists': False}},
-        {'$set': {'magical_powers': []}},
-        multi=True)
+    add_table_field(database, 'creatures', 'magical_powers', [])
 
 
 @RegisterMigration(2, TEST_MIGRATION_REGISTRY)