Browse Source

Added the test on the deletion of the collections (to not delete a basis collection)

Roland Haroutiounian 8 years ago
parent
commit
f0c20aaac4
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      plugins/mongodb_datasource/migration_handler.py

+ 3
- 4
plugins/mongodb_datasource/migration_handler.py View File

@@ -98,10 +98,10 @@ class MongoDbMigrationHandler(object):
98 98
 
99 99
     ## @brief deletes a collection corresponding to a given uid
100 100
     # @see register_change()
101
-    # @todo add a test to prevent the deletion of the basis collections ?
102 101
     def _emclass_delete(self, model, uid, initial_state, new_state):
103
-        collection_name = object_collection_name(model.classes(uid))
104
-        self._delete_collection(collection_name)
102
+        if uid not in MongoDbMigrationHandler.INIT_COLLECTIONS_NAMES:
103
+            collection_name = object_collection_name(model.classes(uid))
104
+            self._delete_collection(collection_name)
105 105
 
106 106
     ## @brief creates a new field in a collection
107 107
     # @see register_change()
@@ -123,7 +123,6 @@ class MongoDbMigrationHandler(object):
123 123
         self._delete_field_in_collection(collection_name, field_name)
124 124
 
125 125
     ## @brief upgrades a field
126
-    # @todo to be implemented
127 126
     def _emfield_upgrade(self, model, uid, initial_state, new_state):
128 127
         collection_name = self._class_collection_name_from_field(model, initial_state)
129 128
         field_name = model.field(uid).name

Loading…
Cancel
Save